Bug 43661 - [4.5 Regression] ice in fold_comparison, at fold-const.c:9579
Summary: [4.5 Regression] ice in fold_comparison, at fold-const.c:9579
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 4.5.0
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-06 03:21 UTC by John Regehr
Modified: 2010-04-06 10:47 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2010-04-06 09:10:53


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Regehr 2010-04-06 03:21:08 UTC
regehr@john-home:~/volatile/bugs/tmp310$ current-gcc -Os small.c -c
small.c: In function ‘func’:
small.c:10:6: internal compiler error: in fold_comparison, at fold-const.c:9579
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

regehr@john-home:~/volatile/bugs/tmp310$ cat small.c

void
func (int *p_51)
{
  int l_174 = 0;
  l_174 |=
    0 ? (unsigned short) (0 ? : 1 *
			  (signed char) (*p_51
					 ^
					 *p_51)
			  >= 0) : *p_51 < *p_51 > *p_51 < 1;
}

regehr@john-home:~/volatile/bugs/tmp310$ current-gcc -v

Using built-in specs.
COLLECT_GCC=current-gcc
COLLECT_LTO_WRAPPER=/home/regehr/z/compiler-install/gcc-r157975-install/libexec/gcc/i686-pc-linux-gnu/4.5.0/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../configure --with-libelf=/usr/local --enable-lto --prefix=/home/regehr/z/compiler-install/gcc-r157975-install --program-prefix=r157975- --enable-languages=c,c++
Thread model: posix
gcc version 4.5.0 20100406 (experimental) (GCC)
Comment 1 Jakub Jelinek 2010-04-06 08:02:41 UTC
Caused by r145254.  Shorter testcase:
int
func (int x)
{
  return 0 ? (unsigned short) (0 ? : 1 * (signed char) (x ^ x) >= 0) : 1;
}
Comment 2 Richard Biener 2010-04-06 09:00:32 UTC
These kind of asserts are really bogus ...

Well.  We have an unfolded tree.
Comment 3 Richard Biener 2010-04-06 09:10:52 UTC
I have a fix for the ICE.
Comment 4 Richard Biener 2010-04-06 10:37:38 UTC
Subject: Bug 43661

Author: rguenth
Date: Tue Apr  6 10:36:57 2010
New Revision: 157984

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157984
Log:
2010-04-06  Richard Guenther  <rguenther@suse.de>

	PR middle-end/43661
	* fold-const.c (fold_comparison): Handle X * 0 CMP 0.

	* gcc.c-torture/compile/pr43661.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr43661.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/fold-const.c
    trunk/gcc/testsuite/ChangeLog

Comment 5 Richard Biener 2010-04-06 10:47:11 UTC
Fixed.