NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/53346: gcc powerpc optimizer bug exposed by lang/mercury



>Number:         53346
>Category:       bin
>Synopsis:       The configure test for use of labels loops on powerpc
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 05 21:00:00 +0000 2018
>Originator:     he%NetBSD.org@localhost
>Release:        NetBSD 8.0_BETA
>Organization:
	I Try
>Environment:
	
	
System: NetBSD golden-delicious.urc.uninett.no 8.0_BETA NetBSD 8.0_BETA (GOLDEN-DELICIOUS) #4: Mon Sep 11 00:24:51 CEST 2017  he%golden-delicious.urc.uninett.no@localhost:/usr/obj/sys/arch/macppc/compile/GOLDEN-DELICIOUS macppc
Architecture: powerpc
Machine: macppc
>Description:
	The configure test for whether one can use labels in
	the compiler in pkgsrc/lang/mercury reveals an optimizer bug
	in gcc 5.4.0 (nb1 20160606).  I've also tested with gcc 5.5.0
	(nb2 20180327), and it also loops on -O2.

	Build the test with -O1, and it works.
	Build it with -O2 or -O3, it loops.
	I added printf()s, and when it loops, it prints

foo
dummy_id
return foo
foo
dummy_id
return foo

ad infinitum or the CPU time limit is exceeded.

>How-To-Repeat:
	Here's the conftest.c file left by configure:

/* confdefs.h */
#define PACKAGE_NAME ""
#define PACKAGE_TARNAME ""
#define PACKAGE_VERSION ""
#define PACKAGE_STRING ""
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define MR_FULLARCH "powerpc--netbsd"
#define MR_VERSION "14.01.1"
#define MR_MKFIFO "/usr/bin/mkfifo"
#define MR_HOSTNAMECMD "/bin/hostname -f"
#define MR_HAVE_SYSCONF 1
#define MR_HAVE_GETPAGESIZE 1
#define MR_HAVE_GETHOSTNAME 1
#define MR_HAVE_MMAP 1
#define MR_HAVE_MPROTECT 1
#define MR_HAVE_POSIX_MEMALIGN 1
#define MR_HAVE_SBRK 1
#define MR_HAVE_MEMMOVE 1
#define MR_HAVE_SIGACTION 1
#define MR_HAVE_SIGINTERRUPT 1
#define MR_HAVE_SETITIMER 1
#define MR_HAVE_SNPRINTF 1
#define MR_HAVE__SNPRINTF 1
#define MR_HAVE_VSNPRINTF 1
#define MR_HAVE__VSNPRINTF 1
#define MR_HAVE_STRERROR 1
#define MR_HAVE_STRERROR_R 1
#define MR_HAVE_OPEN 1
#define MR_HAVE_CLOSE 1
#define MR_HAVE_DUP 1
#define MR_HAVE_DUP2 1
#define MR_HAVE_FDOPEN 1
#define MR_HAVE_FILENO 1
#define MR_HAVE_FSTAT 1
#define MR_HAVE_STAT 1
#define MR_HAVE_LSTAT 1
#define MR_HAVE_ISATTY 1
#define MR_HAVE_GETPID 1
#define MR_HAVE_SETPGID 1
#define MR_HAVE_FORK 1
#define MR_HAVE_EXECLP 1
#define MR_HAVE_WAIT 1
#define MR_HAVE_KILL 1
#define MR_HAVE_GRANTPT 1
#define MR_HAVE_UNLOCKPT 1
#define MR_HAVE_PTSNAME 1
#define MR_HAVE_TCGETATTR 1
#define MR_HAVE_TCSETATTR 1
#define MR_HAVE_IOCTL 1
#define MR_HAVE_ACCESS 1
#define MR_HAVE_SLEEP 1
#define MR_HAVE_OPENDIR 1
#define MR_HAVE_READDIR 1
#define MR_HAVE_CLOSEDIR 1
#define MR_HAVE_MKDIR 1
#define MR_HAVE_SYMLINK 1
#define MR_HAVE_READLINK 1
#define MR_HAVE_GETTIMEOFDAY 1
#define MR_HAVE_SETENV 1
#define MR_HAVE_PUTENV 1
#define MR_HAVE__PUTENV 1
#define MR_HAVE_POSIX_SPAWN 1
#define MR_HAVE_SCHED_YIELD 1
#define MR_HAVE_MKSTEMP 1
#define MR_HAVE_SETRLIMIT 1
#define STDC_HEADERS 1
#define HAVE_SYS_TYPES_H 1
#define HAVE_SYS_STAT_H 1
#define HAVE_STDLIB_H 1
#define HAVE_STRING_H 1
#define HAVE_MEMORY_H 1
#define HAVE_STRINGS_H 1
#define HAVE_INTTYPES_H 1
#define HAVE_STDINT_H 1
#define HAVE_UNISTD_H 1
#define MR_HAVE_UNISTD_H 1
#define MR_HAVE_SYS_WAIT_H 1
#define MR_HAVE_SYS_SIGINFO_H 1
#define MR_HAVE_SYS_SIGNAL_H 1
#define MR_HAVE_UCONTEXT_H 1
#define MR_HAVE_SYS_PARAM_H 1
#define MR_HAVE_SYS_TIME_H 1
#define MR_HAVE_SYS_TIMES_H 1
#define MR_HAVE_SYS_TYPES_H 1
#define MR_HAVE_SYS_STAT_H 1
#define MR_HAVE_FCNTL_H 1
#define MR_HAVE_TERMIOS_H 1
#define MR_HAVE_SYS_IOCTL_H 1
#define MR_HAVE_SYS_RESOURCE_H 1
#define MR_HAVE_DIRENT_H 1
#define MR_HAVE_GETOPT_H 1
#define MR_HAVE_MALLOC_H 1
#define MR_HAVE_SEMAPHORE_H 1
#define MR_HAVE_PTHREAD_H 1
#define MR_HAVE_TIME_H 1
#define MR_HAVE_SPAWN_H 1
#define MR_HAVE_FENV_H 1
#define MR_HAVE_SYS_MMAN_H 1
#define MR_HAVE_SYS_SEM_H 1
#define MR_HAVE_SCHED_H 1
#define MR_HAVE_UTMPX_H 1
#define MR_HAVE_FESETROUND 1
#define MR_SIGACTION_FIELD sa_sigaction
#define MR_HAVE_SIGINFO 1
#define MR_HAVE_SIGINFO_T 1
#define MR_HAVE_SIGINFO 1
#define MR_WORD_TYPE int
#define MR_INTEGER_LENGTH_MODIFIER ""
#define MR_INT_LEAST64_TYPE long long
#define MR_INT_LEAST64_LENGTH_MODIFIER "ll"
#define MR_INT_LEAST32_TYPE int
#define MR_INT_LEAST32_MAX INT_MAX
#define MR_UINT_LEAST32_MAX UINT_MAX
#define HAVE_DEV_T 1
#define HAVE_INO_T 1
#define MR_HAVE_DEV_T 1
#define MR_HAVE_INO_T 1
#define MR_INT_LEAST16_TYPE short
#define MR_INT_LEAST16_MAX SHRT_MAX
#define MR_UINT_LEAST16_MAX USHRT_MAX
#define MR_LOW_TAG_BITS 2
#define MR_BYTES_PER_WORD 4
#define MR_BITS_PER_WORD 32
#define MR_BOXED_FLOAT 1
#define MR_DOUBLE_IS_64_BIT 1
#define MR_LONG_DOUBLE_IS_64_BIT 1
#define MR_SYNC_TERM_SIZE 3
#define MR_BIG_ENDIAN 1
#define MR_HAVE_OCREAT_OEXCL 1
#define MR_CAN_DO_PENDING_IO 1
/* end confdefs.h.  */

    extern void     exit(int);
    void            *entry_foo_1;
    void            *entry_bar_1;
    void            *succip;
    int             global;
    void            *dummy_identity_function(void *);

    foo() {
printf("foo\n");
        entry_foo_1 = && foo_1;
        goto *dummy_identity_function(&&return_label);
    return_label:
printf("return foo\n");
        return;
    foo_1:
printf("foo_1\n");
        __asm__ __volatile__("":::"memory");
        if (global != 42) exit(1);
        goto *entry_bar_1;
    }
    bar() {
printf("bar\n");
        entry_bar_1 = && bar_1;
        goto *dummy_identity_function(&&return_label);
    return_label:
printf("return bar\n");
        return;
    bar_1:
printf("bar_1\n");
        __asm__ __volatile__("":::"memory");
        if (global != 42) exit(1);
        goto *succip;
    }
    main() {
        global = 42;
        foo();
        bar();
        succip = &&last;
        goto *dummy_identity_function(&&return_label);
    return_label:
printf("main_return\n");
        goto *entry_foo_1;
        exit(1);
    last:
printf("main_last\n");
        __asm__ __volatile__("":::"memory");
        if (global != 42) exit(1);
        exit(0);
    }
    void *dummy_identity_function(void *p) {
printf("dummy_id\n");
        return p;
    }

>Fix:
	Sorry, don't know.



Home | Main Index | Thread Index | Old Index