Bug 39212

Summary: ice for AVR target: unable to find a register to spill in class 'POINTER_REGS'
Product: gcc Reporter: John Regehr <regehr>
Component: targetAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED WORKSFORME    
Severity: normal CC: b33fc0d3, eric.weddington, gcc-bugs, gjl, LAL
Priority: P3 Keywords: ice-on-valid-code
Version: 4.3.3   
Target Milestone: 4.6.1   
Host: i686-pc-linux-gnu Target: avr
Build: i686-pc-linux-gnu Known to work: 4.5.2, 4.6.1
Known to fail: 4.3.2, 4.3.3 Last reconfirmed: 2009-02-17 04:43:39
Attachments: Test case for spotting similar error

Description John Regehr 2009-02-17 03:43:49 UTC
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);
}
Comment 1 Eric Weddington 2009-02-17 04:43:39 UTC
Fails on 4.3.2 with -O1, successful with -O[023s].
Comment 2 Eric Weddington 2009-02-17 05:02:28 UTC
Success on 4.3.2 with -O1 -finline-small-functions.
Fails on 4.3.2 with -O1 -fno-inline-small-functions.
Comment 3 Eric Weddington 2009-02-17 05:09:30 UTC
Fails on 4.3.2 with -O[123s] -fno-inline-small-functions.
Success on 4.3.2 with -O0 -fno-inline-small-functions.
Comment 4 Artur Lipowski 2009-03-20 19:29:57 UTC
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
Comment 5 Georg-Johann Lay 2011-07-10 21:13:46 UTC
Eric, can I close this for 4.6.2?
Comment 6 Eric Weddington 2011-07-11 17:57:58 UTC
Since this works on 4.6.1, setting target milestone and closing.