Bug 34412 - ICE in extract_insn, at recog.c:1990
Summary: ICE in extract_insn, at recog.c:1990
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
Keywords: ice-on-valid-code
Depends on:
Reported: 2007-12-09 21:06 UTC by Shaun Jackman
Modified: 2008-01-28 22:49 UTC (History)
4 users (show)

See Also:
Target: avr
Known to work:
Known to fail:
Last reconfirmed: 2007-12-09 21:26:50

Test case (1.58 KB, text/plain)
2007-12-09 21:08 UTC, Shaun Jackman
Fix expander patch (275 bytes, patch)
2008-01-11 23:32 UTC, Andy Hutchinson
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Shaun Jackman 2007-12-09 21:06:46 UTC
$ avr-gcc -mmcu=at90pwm316 -g -O2 -Wall -Wextra -Werror -Os -mtiny-stack -I../.. -I.. -MMD -DBOOTLOADER -DF_CPU=16000000  -c -o serial.o ../../serial.c
../../serial.c: In function ‘serial_read’:
../../serial.c:13: error: unrecognizable insn:
(insn/f 52 51 53 2 ../../serial.c:9 (set (reg:QI 28 r28)
        (plus:QI (reg/f:HI 28 r28)
            (const_int -4 [0xfffffffc]))) -1 (nil))
../../serial.c:13: internal compiler error: in extract_insn, at recog.c:1990
Comment 1 Shaun Jackman 2007-12-09 21:08:08 UTC
Created attachment 14714 [details]
Test case
Comment 2 Andrew Pinski 2007-12-09 21:26:50 UTC
Small testcase:
typedef unsigned int uint32_t __attribute__ ((__mode__ (__SI__)));
eeprom_read_block ( )
  uint32_t serial;
  f(&serial );
Comment 3 Rask Ingemann Lambertsen 2007-12-10 20:42:44 UTC
Broken prologue expander, notice the mode mismatch: (plus:QI (reg/f:HI 
Comment 4 Andy Hutchinson 2008-01-11 23:32:02 UTC
Created attachment 14928 [details]
Fix expander patch

Prior analysis is correct. Typo resulted in QI addition to HI mode frame pointer, when Tiny series target was selected (256 byte stack). The addition was intended to just change LSB as MSB is always fixed.

Patch corrects prolog expander typo so that 8 bit (QI) increment is made to 8 bit representation of frame pointer.
Comment 5 Andy Hutchinson 2008-01-11 23:40:35 UTC
An instant  work around for Tiny Targets is to optimise at higher level (-Os)

This will most likely remove need for frame pointer and skirt around the bug. Though it will still happen if there are more auto variables than registers free.
Comment 6 aesok 2008-01-28 22:40:01 UTC
Subject: Bug 34412

Author: aesok
Date: Mon Jan 28 22:39:11 2008
New Revision: 131923

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=131923
	PR target/34412
	* config/avr/avr.c (expand_prologue): Use correct QI mode frame 
	pointer for tiny stack.


Comment 7 aesok 2008-01-28 22:49:11 UTC
Fixed in HEAD (4.3)
Comment 8 aesok 2009-08-25 19:04:08 UTC
Subject: Bug 34412

Author: aesok
Date: Tue Aug 25 19:03:53 2009
New Revision: 151094

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151094
	PR target/34412
	* config/avr/avr.c (expand_epilogue): Use correct QI mode frame
	pointer for tiny stack.