Bug 15068 - ICE in elim_reg_cond
Summary: ICE in elim_reg_cond
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Richard Earnshaw
URL:
Keywords: ice-on-valid-code
: 15297 20129 21710 (view as bug list)
Depends on:
Blocks: 16624
  Show dependency treegraph
 
Reported: 2004-04-22 10:20 UTC by Philip Blundell
Modified: 2006-04-02 09:05 UTC (History)
5 users (show)

See Also:
Host:
Target: arm-linux
Build:
Known to work:
Known to fail: 3.3.3 3.4.0
Last reconfirmed: 2004-05-01 01:04:05


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philip Blundell 2004-04-22 10:20:55 UTC
This code:

$ cat s_fmax.i
double
__fmax (double x, double y)
{
  return (__builtin_isgreaterequal(x, y) || (sizeof (y) == sizeof (float) ? 
__isnanf (y) : __isnan (y))) ? x : y;
}

crashes an arm-linux compiler when invoked as:

$ ./cc1 -O2 ~/s_fmax.i
 __fmax
 
Analyzing compilation unit
Performing intraprocedural optimizations
Assembling functions:
 __fmax
 
/home/pblundel/s_fmax.i: In function `__fmax':
/home/pblundel/s_fmax.i:5: internal compiler error: in elim_reg_cond, at 
flow.c:3257
Please submit a full bug report,
with preprocessed source if appropriate.
Send email to arm-gcc@codesourcery.com for instructions.
Comment 1 Philip Blundell 2004-04-22 10:42:21 UTC
This bug exists in the 3.3 branch (and the trunk) as well as the 3.4 branch.
Comment 2 Dara Hazeghi 2004-05-01 01:04:05 UTC
Confirmed (on 3.4 branch).
Comment 3 Richard Earnshaw 2004-05-16 22:28:28 UTC
*** Bug 15297 has been marked as a duplicate of this bug. ***
Comment 4 Brett Neumeier 2004-07-21 01:38:11 UTC
I have had the same problem with GCC 3.2.3 (as well as 3.3.3 and 3.4.0),
building a native arm compiler.

I don't know anything substantial about GCC internals, so please excuse if this
comment is totally worthless...but:

In a cursory look at elim_reg_cond, it looked to me as though the function was
encountering an unexpected rtx code.  So I checked, and found that when the ICE
is encountered it's because elim_reg_cond is called with an rtx with code 0
(UNKNOWN).

So in an effort to work around the problem, I modified elim_reg_cond so that
instead of calling abort() it simply returns the original rtx, and as far as I
can tell that does seem to work. (At least, when I ran the test suites for the
glibc I built with this workaround, the tests for the relevant functions all
passed.)
Comment 5 Richard Earnshaw 2004-07-21 10:20:05 UTC
Subject: Re:  ICE in elim_reg_cond

On Wed, 2004-07-21 at 02:38, random at rnd dot cx wrote:

> So in an effort to work around the problem, I modified elim_reg_cond so that
> instead of calling abort() it simply returns the original rtx, and as far as I
> can tell that does seem to work. 
No, that's incorrect.

R.
Comment 6 CVS Commits 2004-08-02 13:19:49 UTC
Subject: Bug 15068

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	pbrook@gcc.gnu.org	2004-08-02 13:19:41

Modified files:
	gcc            : ChangeLog flow.c 

Log message:
	PR rtl-optimization/15068
	* flow.c (init_propagate_block_info): Check condition is reversible.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.4763&r2=2.4764
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/flow.c.diff?cvsroot=gcc&r1=1.593&r2=1.594

Comment 7 CVS Commits 2004-08-02 13:57:11 UTC
Subject: Bug 15068

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	csl-arm-branch
Changes by:	pbrook@gcc.gnu.org	2004-08-02 13:57:06

Modified files:
	gcc            : ChangeLog flow.c 

Log message:
	PR rtl-optimization/15068
	* flow.c (init_propagate_block_info): Check condition is reversible.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=2.1568.2.81&r2=2.1568.2.82
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/flow.c.diff?cvsroot=gcc&only_with_tag=csl-arm-branch&r1=1.563.4.2&r2=1.563.4.3

Comment 8 Andrew Pinski 2004-08-02 16:52:50 UTC
Fixed in 3.5.0.
Comment 9 Andrew Pinski 2005-02-21 23:17:06 UTC
*** Bug 20129 has been marked as a duplicate of this bug. ***
Comment 10 Andrew Pinski 2005-05-22 18:47:14 UTC
*** Bug 21710 has been marked as a duplicate of this bug. ***
Comment 11 Xu Guangyi 2005-06-15 14:59:21 UTC
(In reply to comment #10)
> *** Bug 21710 has been marked as a duplicate of this bug. ***


Is there any patch of it for gcc-3.3.6.


Comment 12 Richard Earnshaw 2005-06-15 15:05:39 UTC
Subject: Re:  ICE in elim_reg_cond

On Wed, 2005-06-15 at 15:59, xuguangyi at ee dot buaa dot edu dot cn
wrote:
> ------- Additional Comments From xuguangyi at ee dot buaa dot edu dot cn  2005-06-15 14:59 -------
> (In reply to comment #10)
> > *** Bug 21710 has been marked as a duplicate of this bug. ***
> 
> 
> Is there any patch of it for gcc-3.3.6.
> 

No.  The code that was fixed was not in gcc-3.3.

R.
Comment 13 Jonathan S. Shapiro 2006-04-02 06:48:23 UTC
Any patch for gcc-3.4.6?
Comment 14 Andrew Pinski 2006-04-02 06:52:28 UTC
(In reply to comment #13)
> Any patch for gcc-3.4.6?

No, just use 4.1.0 or 4.0.2 instead.
Comment 15 Mikael Pettersson 2006-04-02 09:05:55 UTC
(In reply to comment #13)
> Any patch for gcc-3.4.6?
> 

Yes, use the patch shown earlier in this thread,
or the equivalent one provided by crosstool.