Bug 10308 - [3.2/3.3/3.4 regression] [x86] ICE with -O -fgcse or -O2
Summary: [3.2/3.3/3.4 regression] [x86] ICE with -O -fgcse or -O2
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.2.2
: P3 normal
Target Milestone: 3.3
Assignee: Jan Hubicka
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2003-04-04 12:36 UTC by jberlin
Modified: 2004-07-13 17:40 UTC (History)
4 users (show)

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


Attachments
gcc-bug.c (593 bytes, text/x-c )
2003-05-21 15:17 UTC, jberlin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description jberlin 2003-04-04 12:36:00 UTC
I had a bug in my code, which caused gcc to crash. I tried my best at creating the smallest piece of source that still crashes gcc. I added some comments in the source indicating what I discovered during testing..

I haven't been able to reproduce the bug with valid code.

Release:
gcc-3.2.2

Environment:
CFLAGS=-march=athlon-tbird -pipe -mmmx -m3dnow -momit-leaf-frame-pointer
i686-pc-linux-gnu

How-To-Repeat:
Compile with
  gcc -O2 -c gcc-bug.c
or
  gcc -O -fgcse -c gcc-bug.c

I provided two separate code chunks that cause gcc to crash. Add -DOTHER_CASE to the compile command to test with the other chunk.
Comment 2 Wolfgang Bangerth 2003-04-04 17:32:13 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. A regression on all active branches w.r.t. 2.95
Comment 3 s.bosscher 2003-04-07 20:19:43 UTC
From: Steven Bosscher <s.bosscher@student.tudelft.nl>
To: gcc-gnats@gcc.gnu.org, gcc-bugs@gcc.gnu.org, jberlin@cc.hut.fi,
	nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: c/10308: [3.2/3.3/3.4 regression] [x86] ICE with -O -fgcse or
 -O2
Date: Mon, 07 Apr 2003 20:19:43 +0200

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=10308
 
 Starting program: /home/steven/devel/gcc/build-3.3/gcc/cc1 -O2 10308.c
  set_idx somefunc
 10308.c: In function `somefunc':
 10308.c:40: warning: initialization makes pointer from integer without a 
 cast
 10308.c:46: warning: passing arg 2 of `set_idx' makes integer from 
 pointer without a cast
 
 Program received signal SIGSEGV, Segmentation fault.
 print_reg (x=0x4017ce94, code=4, file=0x83dbc90) at 
 ../../gcc-3.3/gcc/config/i386/i386.c:6624
 6624          fputs (hi_reg_name[REGNO (x)], file);
 (gdb) p debug_rtx (x)
 (plus:SI (reg/f:SI 6 ebp)
     (const_int -16 [0xfffffff0]))
 $3 = void
 (gdb) where
 #0  print_reg (x=0x4017ce94, code=4, file=0x83dbc90) at 
 ../../gcc-3.3/gcc/config/i386/i386.c:6624
 #1  0x0820eddd in print_operand_address (file=0x83dbc90, addr=0x4017ce94)
     at ../../gcc-3.3/gcc/config/i386/i386.c:7156
 #2  0x080dc1a0 in output_address (x=0x4017ceac) at 
 ../../gcc-3.3/gcc/final.c:3534
 #3  0x0820eb82 in print_operand (file=0x83dbc90, x=0x4017ceac, code=0)
     at ../../gcc-3.3/gcc/config/i386/i386.c:7012
 #4  0x080dc144 in output_operand (x=0x4017ceb8, code=0) at 
 ../../gcc-3.3/gcc/final.c:3522
 #5  0x080dbcf9 in output_asm_insn (template=0x82bc20c "0|%0, %1}", 
 operands=0x83aefe0)
     at ../../gcc-3.3/gcc/final.c:3445
 #6  0x080daf00 in final_scan_insn (insn=0x40146ad4, file=0x83dbc90, 
 optimize=2, prescan=0,
     nopeepholes=0) at ../../gcc-3.3/gcc/final.c:2814
 #7  0x080da9ff in final (first=0x40146420, file=0x83dbc90, optimize=2, 
 prescan=0)
     at ../../gcc-3.3/gcc/final.c:1904
 #8  0x081f019e in rest_of_compilation (decl=0x40146420) at 
 ../../gcc-3.3/gcc/toplev.c:3584
 
 Are we trying to PRINT_REG something that is not a REG?
 
 Greetz
 Steven
 
 
 
Comment 4 Eric Botcazou 2003-04-08 19:12:36 UTC
Responsible-Changed-From-To: unassigned->hubicka
Responsible-Changed-Why: Submitted a fix.
Comment 5 Jan Hubicka 2003-04-24 15:53:23 UTC
From: hubicka@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c/10308
Date: 24 Apr 2003 15:53:23 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	hubicka@gcc.gnu.org	2003-04-24 15:53:23
 
 Modified files:
 	gcc            : ChangeLog cfgbuild.c 
 	gcc/config/i386: athlon.md i386.c i386.md 
 	gcc/doc        : invoke.texi 
 
 Log message:
 	* cfgbuild.c (make_edges):  Do not use next_nonnote_insn when
 	looking for fallthru edge.
 	
 	* athlon.md (athlon-agu, athlon-store, athlon-fany, athlon-faddmul):
 	Fix.
 	(athlon-load2, athlon-store2, athlon-fpsched, athlon-fpload,
 	athlon-fvector): New.
 	(athlon_*): Revisit to match new optimization guide.
 	* i386.c (ix86_adjust_cost):  Fix memory operand costs on Athlon/k8
 	* i386.md (cvt??2?? patterns): Fix modes.
 	(fistp patterns): Set modes.
 	
 	Accidentaly commited with my earlier reload patch:
 	PR c/10308
 	* reload.c (find_reloads_address_1): Reload plus at the place of
 	index register.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=1.17583&r2=1.17584
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgbuild.c.diff?cvsroot=gcc&r1=1.34&r2=1.35
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/athlon.md.diff?cvsroot=gcc&r1=1.5&r2=1.6
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&r1=1.560&r2=1.561
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&r1=1.455&r2=1.456
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&r1=1.269&r2=1.270
 

Comment 6 Jan Hubicka 2003-04-28 07:58:31 UTC
From: hubicka@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c/10308
Date: 28 Apr 2003 07:58:31 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_3-branch
 Changes by:	hubicka@gcc.gnu.org	2003-04-28 07:58:31
 
 Modified files:
 	gcc            : ChangeLog reload.c 
 
 Log message:
 	PR c/10308
 	* reload.c (find_reloads_address_1): Reload plus at the place of
 	index register.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.481&r2=1.16114.2.482
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/reload.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.199.2.7&r2=1.199.2.8
 

Comment 7 Dara Hazeghi 2003-05-14 17:19:26 UTC
From: Dara Hazeghi <dhazeghi@yahoo.com>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c/10308: [3.2/3.3/3.4 regression] [x86] ICE with -O -fgcse or -O2
Date: Wed, 14 May 2003 17:19:26 -0700

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit- 
 trail&database=gcc&pr=10308
 
 Hello,
 
 this bug appears in gcc 3.2, but on 3.3 branch and mainline (20030509),  
 I cannot reproduce it (with any of the suggested options). It appears  
 that Jan Hubricka's patch fixed it, so this PR can be closed.
 
 Dara
 
Comment 8 Wolfgang Bangerth 2003-05-15 04:46:10 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Jan fixed it.