Compiling the following program causes gcc to crash when using the -std=gnu99 option, but there is no crash without this option. I need to use this option because the program uses language features such as loop initial declarations which require passing -std=c99 or -std=gnu99 option.
================= typedef unsigned long long uint64_t; int test(uint64_t result, uint64_t multiplier) { if (result > (18446744073709551615) / multiplier) return 1; else return 2; } ================= $ /usr/local/gcc-4.4.0/bin/gcc -v -save-temps -std=gnu99 -c bug.c Using built-in specs. Target: powerpc-ibm-aix4.3.3.0 Configured with: /mnt/gcc-4.4.0/configure --prefix=/usr/local/gcc-4.4.0 --enable-languages=c,c++ --disable-nls --disable-shared --disable-multilib --with-float=hard --with-cpu=powerpc Thread model: aix gcc version 4.4.0 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=gnu99' '-c' '-mcpu=powerpc' '-mhard-float' /usr/local/gcc-4.4.0/libexec/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/cc1 -E -quiet -v bug.c -mcpu=powerpc -mhard-float -std=gnu99 -fpch-preprocess -o bug.i ignoring nonexistent directory "/usr/local/gcc-4.4.0/lib/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/../../../../powerpc-ibm-aix4.3.3.0/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/local/gcc-4.4.0/include /usr/local/gcc-4.4.0/lib/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/include /usr/local/gcc-4.4.0/lib/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=gnu99' '-c' '-mcpu=powerpc' '-mhard-float' /usr/local/gcc-4.4.0/libexec/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/cc1 -fpreprocessed bug.i -quiet -dumpbase bug.c -mcpu=powerpc -mhard-float -auxbase bug -std=gnu99 -version -o bug.s GNU C (GCC) version 4.4.0 (powerpc-ibm-aix4.3.3.0) compiled by GNU C version 4.4.0, GMP version 4.3.1, MPFR version 2.4.1. GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 069cba7204d31344321186fb361b8726 bug.c:3:17: warning: integer constant is so large that it is unsigned bug.c: In function 'test': bug.c:3: internal compiler error: in gen_lowpart_general, at rtlhooks.c:59 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. $ ls -l total 24 -rw-r--r-- 1 vvv noc 175 May 19 17:51 bug.c -rw-r--r-- 1 vvv noc 237 May 19 17:56 bug.i -rw-r--r-- 1 vvv noc 57 May 19 17:56 bug.s $ cat bug.i # 1 "bug.c" # 1 "<built-in>" # 1 "<command-line>" # 1 "bug.c" typedef unsigned long long uint64_t; int test(uint64_t result, uint64_t multiplier) { if (result > (18446744073709551615) / multiplier) return 1; else return 2; } $ cat bug.s .file "bug.c" .csect .text[PR] .toc .csect .text[PR] Compiling the same file without the -std=gnu99 option works: $ /usr/local/gcc-4.4.0/bin/gcc -v -save-temps -c bug.c Using built-in specs. Target: powerpc-ibm-aix4.3.3.0 Configured with: /mnt/gcc-4.4.0/configure --prefix=/usr/local/gcc-4.4.0 --enable-languages=c,c++ --disable-nls --disable-shared --disable-multilib --with-float=hard --with-cpu=powerpc Thread model: aix gcc version 4.4.0 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mcpu=powerpc' '-mhard-float' /usr/local/gcc-4.4.0/libexec/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/cc1 -E -quiet -v bug.c -mcpu=powerpc -mhard-float -fpch-preprocess -o bug.i ignoring nonexistent directory "/usr/local/gcc-4.4.0/lib/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/../../../../powerpc-ibm-aix4.3.3.0/include" #include "..." search starts here: #include <...> search starts here: /usr/local/include /usr/local/gcc-4.4.0/include /usr/local/gcc-4.4.0/lib/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/include /usr/local/gcc-4.4.0/lib/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/include-fixed /usr/include End of search list. COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mcpu=powerpc' '-mhard-float' /usr/local/gcc-4.4.0/libexec/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/cc1 -fpreprocessed bug.i -quiet -dumpbase bug.c -mcpu=powerpc -mhard-float -auxbase bug -version -o bug.s GNU C (GCC) version 4.4.0 (powerpc-ibm-aix4.3.3.0) compiled by GNU C version 4.4.0, GMP version 4.3.1, MPFR version 2.4.1. GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: 069cba7204d31344321186fb361b8726 bug.c:3:17: warning: integer constant is so large that it is unsigned bug.c: In function 'test': bug.c:3: warning: this decimal constant is unsigned only in ISO C90 bug.c:3: warning: integer constant is too large for 'long' type COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mcpu=powerpc' '-mhard-float' as -u -mppc -o bug.o bug.s COMPILER_PATH=/usr/local/gcc-4.4.0/libexec/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/:/usr/local/gcc-4.4.0/libexec/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/:/usr/local/gcc-4.4.0/libexec/gcc/powerpc-ibm-aix4.3.3.0/:/usr/local/gcc-4.4.0/lib/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/:/usr/local/gcc-4.4.0/lib/gcc/powerpc-ibm-aix4.3.3.0/ LIBRARY_PATH=/usr/local/gcc-4.4.0/lib/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/:/usr/local/gcc-4.4.0/lib/gcc/powerpc-ibm-aix4.3.3.0/4.4.0/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-save-temps' '-c' '-mcpu=powerpc' '-mhard-float' $ ls -l total 40 -rw-r--r-- 1 vvv noc 175 May 19 17:51 bug.c -rw-r--r-- 1 vvv noc 237 May 19 18:27 bug.i -rw-r--r-- 1 vvv noc 639 May 19 18:27 bug.o -rw-r--r-- 1 vvv noc 764 May 19 18:27 bug.s $ cat bug.s .file "bug.c" .csect .text[PR] .toc .csect .text[PR] .align 2 .globl test .globl .test .csect test[DS] test: .long .test, TOC[tc0], 0 .csect .text[PR] .test: mflr 0 stw 0,8(1) stw 31,-4(1) stwu 1,-96(1) mr 31,1 stw 3,56(31) stw 4,60(31) stw 5,64(31) stw 6,68(31) li 3,-1 li 4,-1 lwz 5,64(31) lwz 6,68(31) bl .__udivdi3 nop mr 10,4 mr 9,3 lwz 0,56(31) cmplw 7,0,9 bgt 7,L..6 lwz 0,56(31) cmpw 7,0,9 bne 7,L..2 lwz 0,60(31) cmplw 7,0,10 ble 7,L..2 L..6: li 0,1 b L..4 L..2: li 0,2 L..4: mr 3,0 addi 1,31,96 lwz 0,8(1) mtlr 0 lwz 31,-4(1) blr LT..test: .long 0 .byte 0,0,32,97,128,1,4,1 .long 0 .long LT..test-.test .short 4 .byte "test" .byte 31 .align 2 _section_.text: .csect .data[RW],4 .long _section_.text ================================================= this may be related to usage of libgcc's __udivdi3; because with gcc 3.3 on the same platform this function is missing from libgcc; in gcc 4.4.0, it is there, but the compiler crashes when using -std=gnu99 option. -- Summary: crash when using -std=gnu99, no crash without -std=gnu99 Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vvv at vsu dot ru GCC build triplet: powerpc-ibm-aix4.3.3.0 GCC host triplet: powerpc-ibm-aix4.3.3.0 GCC target triplet: powerpc-ibm-aix4.3.3.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40199