[patch, avr] Fix unrecognizable insn ICE for avr (PR71103)

Pitchumani Sivanupandi pitchumani.sivanupandi@atmel.com
Fri May 13 13:51:00 GMT 2016


avr-gcc crashes for following test as it couldn't recognize the
instruction pattern.

struct st {
  unsigned char uc1;
  unsigned int *ui1;
};

unsigned int ui1;
struct st foo () {
  struct st ret;
  ret.uc1 = 6;
  ret.ui1 = &ui1;
  return ret;
}

$ avr-gcc -mmcu=atmega328p -O1 test.c
(-- snip --) 
test.c: In function 'foo':
test.c:12:1: error: unrecognizable insn:
 }
 ^
(insn 6 5 7 2 (set (subreg:QI (reg:PSI 42 [ D.1499 ]) 1)
        (subreg:QI (symbol_ref:HI ("ui1") <var_decl 0x7f372169e900
ui1>) 0)) test.c:11 -1
     (nil))
test.c:12:1: internal compiler error: in extract_insn, at recog.c:2287
0xd51195 _fatal_insn(char const*, rtx_def const*, char const*, int,
char const*)
    /home/rudran/code/gcc/gcc/rtl-error.c:108
(-- snip --) 

There is no valid pattern in avr to match the "subreg:QI
(symbol_ref:HI)". Attached patch forces the symbol_ref of subreg
operand to register so that it will become register operand and movqi
pattern shall recognize it.

Ran gcc regression test with internal simulators. No new regressions
found.

If ok, could someone commit please?

Regards,
Pitchumani
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr71103.patch
Type: text/x-patch
Size: 1187 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20160513/ceda087d/attachment.bin>


More information about the Gcc-patches mailing list