Bug 19743 - internal compiler error on errneous code
Summary: internal compiler error on errneous code
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 3.4.3
: P2 normal
Target Milestone: 4.0.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2005-02-01 18:04 UTC by Heikki Orsila
Modified: 2005-07-23 22:49 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Heikki Orsila 2005-02-01 18:05:00 UTC
Following invalid C function gives internal compiler error on x86_64, but not on
x86, on GCC 3.4.3 and 3.3.5:

char blabla(unsigned int a)
{
  return &((unsigned char *) &a)[0];
}

3.3.5 gives:

$ ./gcc -Wall -O2 -c /test/char.c
/test/char.c: In function `blabla':
/test/char.c:3: warning: return makes integer from pointer without a cast
/test/char.c:4: error: unrecognizable insn:
(insn 29 11 13 0 (nil) (set (reg:SI 0 eax [62])
        (subreg:SI (plus:DI (subreg:DI (reg:QI 7 spl) 0)
                (const_int -4 [0xfffffffffffffffc])) 0)) -1 (nil)
    (nil))
/test/char.c:4: internal compiler error: in extract_insn, at recog.c:2175

$ ./gcc -v
Reading specs from /build/gcc/lib/gcc-lib/x86_64-unknown-linux-gnu/3.3.5/specs
Configured with: ./configure --enable-languages=c --prefix=/build/gcc
Thread model: posix
gcc version 3.3.5


3.4.3 gives:

$ ./gcc -Wall -O2 -c /test/char.c
/test/char.c: In function `blabla':
/test/char.c:3: warning: return makes integer from pointer without a cast
/test/char.c:4: error: unrecognizable insn:
(insn 30 11 13 0 (set (reg:SI 0 ax [62])
        (subreg:SI (plus:DI (subreg:DI (reg:QI 7 sp) 0)
                (const_int -4 [0xfffffffffffffffc])) 0)) -1 (nil)
    (nil))
/test/char.c:4: internal compiler error: in extract_insn, at recog.c:2083

$ ./gcc -v
Reading specs from /build/gcc/lib/gcc/x86_64-unknown-linux-gnu/3.4.3/specs
Configured with: ./configure --enable-languages=c --prefix=/build/gcc
Thread model: posix
gcc version 3.4.3
Comment 1 Andrew Pinski 2005-02-01 18:19:19 UTC
The code is undefined but still valid, well really it is invalid if you don't have a cast.
This is all fixed on the mainline for 4.0.0 anyways and since this is not a regression closing as fixed.