This bug is seen using the avr-gcc that gets built by the script that comes with FemtoOS 0.88. regehr@john-home:~/volatile/tmp140$ avr-gcc -O1 small.c small.c: In function 'uint32func': small.c:22: error: unable to find a register to spill in class 'POINTER_REGS' small.c:22: error: this is the insn: (insn 61 59 141 4 small.c:20 (set (reg:SI 24 r24 [55]) (ashiftrt:SI (subreg:SI (reg/v:DI 46 [ p_48 ]) 0) (const_int 31 [0x1f]))) 60 {ashrsi3} (nil)) small.c:22: confused by earlier errors, bailing out regehr@john-home:~/volatile/tmp140$ avr-gcc -v Using built-in specs. Target: avr Configured with: ../gcc-4.3.3/configure --prefix=/home/regehr/avr-gcc-test --target=avr --with-gnu-ld --with-gnu-as --enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2 Thread model: single gcc version 4.3.3 (GCC) regehr@john-home:~/volatile/tmp140$ cat small.c typedef int uint64_t __attribute__ ((__mode__ (__DI__))); static long int safe_mod_func_int32_t_s_s (long int _si1, long int _si2) { return -1 ? _si1 : 1; } uint64_t safe_sub_func_uint64_t_u_u (uint64_t _ui1, uint64_t _ui2) { return 0; } int foo (int,int,int); int bar (int); long int g_14; int uint32func (uint64_t p_48) { return foo (safe_mod_func_int32_t_s_s (p_48, 0) == safe_sub_func_uint64_t_u_u (g_14, 1), bar (g_14 == 1), 1); }
Fails on 4.3.2 with -O1, successful with -O[023s].
Success on 4.3.2 with -O1 -finline-small-functions. Fails on 4.3.2 with -O1 -fno-inline-small-functions.
Fails on 4.3.2 with -O[123s] -fno-inline-small-functions. Success on 4.3.2 with -O0 -fno-inline-small-functions.
Created attachment 17504 [details] Test case for spotting similar error The host is Fedora 8. [artur@gizmo AVR]$ avr-gcc -v -save-temps -std=gnu99 -pedantic -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Wshadow -Werror -g -Os -mmcu=atmega8 -DF_CPU=4000000 -I../sst -I../examples -I. ../sst/sst_timer.c -c -o sst_timer.o Using built-in specs. Target: avr Configured with: ../gcc-4.3.3/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-system-zlib --enable-version-specific-runtime-libs Thread model: single gcc version 4.3.3 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=gnu99' '-pedantic' '-Wall' '-Wpointer-arith' '-Wstrict-prototypes' '-Winline' '-Wundef' '-Wshadow' '-Werror' '-g' '-Os' '-mmcu=atmega8' '-DF_CPU=4000000' '-I../sst' '-I../examples' '-I.' '-c' '-E' /usr/libexec/gcc/avr/4.3.3/cc1 -E -quiet -v -I../sst -I../examples -I. -imultilib avr4 -DF_CPU=4000000 ../sst/sst_timer.c -mmcu=atmega8 -std=gnu99 -pedantic -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Wshadow -Werror -fworking-directory -Os -fpch-preprocess ignoring nonexistent directory "/usr/lib/gcc/avr/4.3.3/../../../../avr/sys-include" #include "..." search starts here: #include <...> search starts here: ../sst ../examples . /usr/lib/gcc/avr/4.3.3/include /usr/lib/gcc/avr/4.3.3/include-fixed /usr/lib/gcc/avr/4.3.3/../../../../avr/include End of search list. COMPILER_PATH=/usr/libexec/gcc/avr/4.3.3/:/usr/libexec/gcc/avr/4.3.3/:/usr/libexec/gcc/avr/:/usr/lib/gcc/avr/4.3.3/:/usr/lib/gcc/avr/:/usr/lib/gcc/avr/4.3.3/../../../../avr/bin/ LIBRARY_PATH=/usr/lib/gcc/avr/4.3.3/avr4/:/usr/lib/gcc/avr/4.3.3/../../../../avr/lib/avr4/:/usr/lib/gcc/avr/4.3.3/:/usr/lib/gcc/avr/4.3.3/../../../../avr/lib/ COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=gnu99' '-pedantic' '-Wall' '-Wpointer-arith' '-Wstrict-prototypes' '-Winline' '-Wundef' '-Wshadow' '-Werror' '-g' '-Os' '-mmcu=atmega8' '-DF_CPU=4000000' '-I../sst' '-I../examples' '-I.' '-c' '-E' Using built-in specs. Target: avr Configured with: ../gcc-4.3.3/configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --target=avr --enable-languages=c,c++ --disable-nls --disable-libssp --with-system-zlib --enable-version-specific-runtime-libs Thread model: single gcc version 4.3.3 (GCC) COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=gnu99' '-pedantic' '-Wall' '-Wpointer-arith' '-Wstrict-prototypes' '-Winline' '-Wundef' '-Wshadow' '-Werror' '-g' '-Os' '-mmcu=atmega8' '-DF_CPU=4000000' '-I../sst' '-I../examples' '-I.' '-c' '-o' '/home/artur/.ccache/tmp.hash.gizmo.my.net.7744.o' /usr/libexec/gcc/avr/4.3.3/cc1 -fpreprocessed /home/artur/.ccache/sst_timer.tmp.gizmo.my.net.7744.i -quiet -dumpbase sst_timer.tmp.gizmo.my.net.7744.i -mmcu=atmega8 -auxbase-strip /home/artur/.ccache/tmp.hash.gizmo.my.net.7744.o -g -Os -pedantic -Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Wshadow -Werror -std=gnu99 -version -o sst_timer.tmp.gizmo.my.net.7744.s GNU C (GCC) version 4.3.3 (avr) compiled by GNU C version 4.1.2 20070925 (Red Hat 4.1.2-33), GMP version 4.2.2, MPFR version 2.3.0-p2. GGC heuristics: --param ggc-min-expand=99 --param ggc-min-heapsize=129486 Compiler executable checksum: 0f701a251c25f23220baf95564516c01 ../sst/sst_timer.c: In function 'SST_TimerTick': ../sst/sst_timer.c:294: error: unable to find a register to spill in class 'BASE_POINTER_REGS' ../sst/sst_timer.c:294: error: this is the insn: (insn 197 129 131 26 ../sst/sst_timer.c:288 (set (mem/c:QI (plus:HI (reg/f:HI 28 r28) (const_int 1 [0x1])) [10 S1 A8]) (reg:QI 25 r25)) 4 {*movqi} (nil)) ../sst/sst_timer.c:294: confused by earlier errors, bailing out
Eric, can I close this for 4.6.2?
Since this works on 4.6.1, setting target milestone and closing.