http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51050

             Bug #: 51050
           Summary: [AVR, attiny26] ICE: invalid rtl sharing found in the
                    insn
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: w...@hhhh.org
            Target: avr


A trivial C program causes an ICE when compiling for attiny26 with the current
head revision of 4.7.0. Compiling for some other chips (attiny48, atmega8,
atmega328) does not cause the abort and generates valid-looking compiled code;
I'd guess the bug has to do with the tiny26's 8-bit stack. Bisecting suggests
that the bug was introduced in svn revision 180654.

$ cat /tmp/foo.c

extern void qq(char *);
int z(int y)
{
  char buf[16];
  qq(buf);
}

$ avr-gcc -v -mmcu=attiny26 -save-temps -S /tmp/foo.c
Using built-in specs.COLLECT_GCC=avr-gcc
COLLECT_LTO_WRAPPER=/Volumes/Users/wiml/netsrc/gcc.gnu.org/local/libexec/gcc/avr/4.7.0/lto-wrapper
Target: avr
Configured with: ../svn_trunk/configure
--prefix=/Volumes/Users/wiml/netsrc/gcc.gnu.org/local --disable-libquadmath
--disable-nls --target=avr --program-prefix=avr- --enable-languages=c,lto
CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib
Thread model: single
gcc version 4.7.0 20111109 (experimental) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-mmcu=attiny26' '-save-temps' '-S'
 /Volumes/Users/wiml/netsrc/gcc.gnu.org/local/libexec/gcc/avr/4.7.0/cc1 -E
-quiet -v /tmp/foo.c -mmcu=attiny26 -fpch-preprocess -o foo.i
ignoring nonexistent directory
"/Volumes/Users/wiml/netsrc/gcc.gnu.org/local/lib/gcc/avr/4.7.0/../../../../avr/sys-include"
ignoring nonexistent directory
"/Volumes/Users/wiml/netsrc/gcc.gnu.org/local/lib/gcc/avr/4.7.0/../../../../avr/include"
#include "..." search starts here:
#include <...> search starts here:
 /Volumes/Users/wiml/netsrc/gcc.gnu.org/local/lib/gcc/avr/4.7.0/include
 /Volumes/Users/wiml/netsrc/gcc.gnu.org/local/lib/gcc/avr/4.7.0/include-fixed
End of search list.
COLLECT_GCC_OPTIONS='-v' '-mmcu=attiny26' '-save-temps' '-S'
 /Volumes/Users/wiml/netsrc/gcc.gnu.org/local/libexec/gcc/avr/4.7.0/cc1
-fpreprocessed foo.i -quiet -dumpbase foo.c -mmcu=attiny26 -auxbase foo
-version -o foo.s
GNU C (GCC) version 4.7.0 20111109 (experimental) (avr)
    compiled by GNU C version 4.2.1 (Apple Inc. build 5666) (dot 3), GMP
version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
GNU C (GCC) version 4.7.0 20111109 (experimental) (avr)
    compiled by GNU C version 4.2.1 (Apple Inc. build 5666) (dot 3), GMP
version 5.0.2, MPFR version 3.1.0-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 38c37072b2c126f5fc58cd8e589f05d3
/tmp/foo.c: In function 'z':
/tmp/foo.c:6:1: error: invalid rtl sharing found in the insn
(insn/f 22 21 23 2 (set (subreg:QI (reg/f:HI 28 r28) 0)
        (plus:QI (subreg:QI (reg/f:HI 28 r28) 0)
            (const_int -18 [0xffffffffffffffee]))) /tmp/foo.c:3 -1
     (expr_list:REG_CFA_ADJUST_CFA (set (reg/f:HI 28 r28)
            (plus:HI (reg/f:HI 32 __SP_L__)
                (const_int -18 [0xffffffffffffffee])))
        (nil)))
/tmp/foo.c:6:1: error: shared rtx
(subreg:QI (reg/f:HI 28 r28) 0)
/tmp/foo.c:6:1: internal compiler error: internal consistency failure
Please submit a full bug report,


Narrowing down revisions with the problem:

181189: fails.
181043: fails.
180844: fails.
180672: fails.
180661: fails.
180655: fails.
180654: fails.
180653: succeeds.
180652: succeeds.
180650: does not compile
180647: does not compile
180639: succeeds.
180629: succeeds.
180586: succeeds.
180500: succeeds.
179995: succeeds.
179412: succeeds.

Reply via email to