User account creation filtered due to spam.

Bug 16298 - [3.4 regression] ICE in output_operand
Summary: [3.4 regression] ICE in output_operand
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 3.4.2
Assignee: Richard Henderson
URL:
Keywords: ice-on-valid-code, monitored
Depends on:
Blocks:
 
Reported: 2004-06-30 15:38 UTC by gige28wa
Modified: 2004-10-30 21:10 UTC (History)
3 users (show)

See Also:
Host:
Target: i686-pc-linux-gnu
Build:
Known to work: 3.3.4 4.0.0
Known to fail: 3.4.0 3.4.1
Last reconfirmed: 2004-06-30 15:56:17


Attachments
All files needed to crash gcc (176.16 KB, application/octet-stream)
2004-06-30 15:40 UTC, gige28wa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description gige28wa 2004-06-30 15:38:02 UTC
The compilation is aborded after compiling the main file join as attached document.

the command line is the following one.

cc -O -v -save-temps -I../../src -Izlib -DUSE_LIBZ     -c -o main.o main.c

and the output 

Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.0/specs
Configured with: ../gcc-3.4.0/configure --prefix=/usr --disable-debug
--enable-shared
Thread model: posix
gcc version 3.4.0
 /usr/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1 -E -quiet -v -I../../src -Izlib
-DUSE_LIBZ main.c -mtune=pentiumpro -O -o main.i
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/3.4.0/../../../../i686-pc-linux-gnu/include"
ignoring nonexistent directory "../../src"
ignoring nonexistent directory "zlib"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/gcc/i686-pc-linux-gnu/3.4.0/include
 /usr/include
End of search list.
 /usr/libexec/gcc/i686-pc-linux-gnu/3.4.0/cc1 -fpreprocessed main.i -quiet
-dumpbase main.c -mtune=pentiumpro -auxbase-strip main.o -O -version -o main.s
GNU C version 3.4.0 (i686-pc-linux-gnu)
        compiled by GNU C version 3.4.0.
GGC heuristics: --param ggc-min-expand=64 --param ggc-min-heapsize=64571
main.c: In function `mainTotalTaskEntryInitialisations':
main.c:2237: internal compiler error: output_operand: invalid expression as operand
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Some precision about my computer.

This is a laptop with pentium4 processor and linux kernel 2.6.5 and glibc 2.3.2.
Comment 1 gige28wa 2004-06-30 15:40:24 UTC
Created attachment 6665 [details]
All files needed to crash gcc

The file contains all headers files and source file in c, needed to crash gcc
during compilation. I also add the *.i and *.s file.
Comment 2 Wolfgang Bangerth 2004-06-30 15:44:49 UTC
Confirmed. Working on a small testcase. 
W. 
Comment 3 Wolfgang Bangerth 2004-06-30 15:56:17 UTC
This is a 3.4/3.5 regression: 
------------------------ 
extern char ca[4000000]; 
extern int i; 
 
void foo() { 
  i = 0; 
  i = (int)(ca+ (3 - ((int)(ca+i-1) & 3))); 
} 
------------------------- 
 
g/x> /home/bangerth/bin/gcc-3.3.4-pre/bin/gcc -c x.c -O 
 
g/x> /home/bangerth/bin/gcc-3.4-pre/bin/gcc -c x.c -O 
x.c: In function `foo': 
x.c:7: internal compiler error: output_operand: invalid expression as operand 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
g/x> /home/bangerth/bin/gcc-3.5-pre/bin/gcc -c x.c -O 
x.c: In function `foo': 
x.c:7: internal compiler error: output_operand: invalid expression as operand 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
W. 
Comment 4 Volker Reichelt 2004-07-13 21:44:39 UTC
Even more compact testcase:

========================================
char c;

int foo()
{
    return 1 - (1 & (int)(&c-1));
}
========================================
Comment 5 Andrew Pinski 2004-07-13 22:43:28 UTC
The problem is that the back-end does not reject
(const:SI (neg:SI (symbol_ref:SI ("c") <var_decl 0x401004fc c>)))
as a constant, I think this is just like the case where 1-c was not rejected also.
Comment 6 Mark Mitchell 2004-08-23 19:37:44 UTC
Richard, this looks like it might have an easy fix.  Care to take a whack?
Comment 7 Richard Henderson 2004-08-23 21:49:51 UTC
Testing patch.
Comment 8 CVS Commits 2004-08-24 21:46:03 UTC
Subject: Bug 16298

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rth@gcc.gnu.org	2004-08-24 21:46:00

Modified files:
	gcc            : ChangeLog 
	gcc/config/i386: i386.c 

Log message:
	PR target/16298
	* config/i386/i386.c (legitimate_constant_p): Rework to not accept
	random codes within CONST.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.5074&r2=2.5075
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.715&r2=1.716

Comment 9 CVS Commits 2004-08-25 05:19:16 UTC
Subject: Bug 16298

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	rth@gcc.gnu.org	2004-08-25 05:19:09

Modified files:
	gcc            : ChangeLog 
	gcc/config/i386: i386.c 

Log message:
	PR target/16298
	* config/i386/i386.c (legitimate_constant_p): Rework to not accept
	random codes within CONST.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.593&r2=2.2326.2.594
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.635.2.14&r2=1.635.2.15

Comment 10 Richard Henderson 2004-08-25 05:19:45 UTC
Fixed.
Comment 11 Giovanni Bajo 2004-08-25 13:16:21 UTC
Richard, is there a reason why the testcase wasn't added to the testsuite?
Comment 12 Richard Henderson 2004-08-25 16:41:42 UTC
Um, no, I guess not.