This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

avr-gcc: incorrect first operand of a subreg? (PR71103)


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] &lt;var_decl 0x7fda2ef3b900 response&gt;)
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ(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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]