Hi, avr-gcc was crashing for below test case. command line: avr-gcc -mmcu=atmega328p -O1 test.c <test.c> struct ResponseStruct{ unsigned char responseLength; char *response; };
static char response[5]; struct ResponseStruct something(){ struct ResponseStruct returnValue; returnValue.responseLength = 5; returnValue.response = response + 1; return returnValue; } Output: > test.c:12:1: error: unrecognizable insn: > } > ^ > (insn 6 5 7 2 (set (subreg:QI (reg:PSI 42 [ D.1499 ]) 1) > (subreg:QI (const:HI (plus:HI (symbol_ref:HI ("response") > [flags 0x2] <var_decl 0x7fda2ef3b900 response>) > (const_int -1 [0xffffffffffffffff > ]))) 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 Source operand is a subreg which has const operand as first operand. Subreg shall have pseudo, mem or hard registers as fist operand. Ref: https://gcc.gnu.org/onlinedocs/gccint/Regs-and-Memory.html For the reported case it has const expression. Isn't that incorrect? validate_subreg doesn't seem to reject this case. How can we avoid such case (avr target)? Regards, Pitchumani