This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
avr-gcc: incorrect first operand of a subreg? (PR71103)
- From: Pitchumani Sivanupandi <pitchumani dot sivanupandi at atmel dot com>
- To: <gcc at gcc dot gnu dot org>, <gjl at gcc dot gnu dot org>, <denisc at gcc dot gnu dot org>
- Date: Tue, 31 May 2016 19:47:38 +0000
- Subject: avr-gcc: incorrect first operand of a subreg? (PR71103)
- Authentication-results: sourceware.org; auth=none
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