This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug optimization/15340] New: GCC internal error in preprocessed C code
- From: "gcc-bugzilla at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 May 2004 19:56:28 -0000
- Subject: [Bug optimization/15340] New: GCC internal error in preprocessed C code
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
GCC throws an internal compiler error on the following code when run with optimizations. Bug exists in 3.2, 3.3, and 3.4.
Environment:
System: Linux mrbean 2.6.1 #1 Wed Jan 21 16:45:49 CST 2004 i686 GNU/Linux
Architecture: i686
libc: 2.3.2.ds1-12 (Debian)
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
Configured with: ./configure --enable-languages=c --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-debug
How-To-Repeat:
Here's the command-line I ran with output:
davedude@mrbean:/usr/src/gcc-3.4.0/gcc$ ./xgcc -B. -v -O2 -fno-strict-aliasing ~/c/uiuc/cs348/mp6/bug.i
Reading specs from ./specs
Configured with: ./configure --enable-languages=c --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-debug
Thread model: posix
gcc version 3.4.0
./cc1 -fpreprocessed /home/davedude/c/uiuc/cs348/mp6/bug.i -quiet -dumpbase bug.i -mtune=pentiumpro -auxbase bug -O2 -version -fno-strict-aliasing -o /tmp/ccOtjqJK.s
GNU C version 3.4.0 (i686-pc-linux-gnu)
compiled by GNU C version 3.3.3 (Debian 20040401).
GGC heuristics: --param ggc-min-expand=47 --param ggc-min-heapsize=32090
bug.c: In function `main':
bug.c:20: error: insn does not satisfy its constraints:
(insn:HI 41 40 53 2 (set (reg/v:SI 3 bx [orig:74 y ] [74])
(sign_extend:SI (mem/s/j:QI (mult:SI (plus:SI (reg/f:SI 6 bp)
(const_int -13 [0xfffffff3]))
(const_int 2 [0x2])) [0 dir S1 A8]))) 86 {extendqisi2} (nil)
(nil))
bug.c:20: internal compiler error: in reload_cse_simplify_operands, at postreload.c:378
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Here's bug.i:
# 1 "bug.c"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "bug.c"
int globl;
void dummy(char arg)
{
globl = arg;
}
int main(int argc, char *argv[])
{
char dir[1];
int y = 0, best;
while (y > *argv[0])
{
best = (int)dir;
y = dir[best];
dummy(*argv[1|best]);
}
return 0;
}
------- Additional Comments From dawalker at uiuc dot edu 2004-05-07 19:56 -------
Fix:
Bug only appears with optimizations on. Also, this is as small as I could make
the bug. Most changes to the above code will remove the problem. Although the
code is obviously artificial, the problem did crop up in real code originally.
--
Summary: GCC internal error in preprocessed C code
Product: gcc
Version: 3.4
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dawalker at uiuc dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15340