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)
Caused by r145254. Shorter testcase: int func (int x) { return 0 ? (unsigned short) (0 ? : 1 * (signed char) (x ^ x) >= 0) : 1; }
These kind of asserts are really bogus ... Well. We have an unfolded tree.
I have a fix for the ICE.
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
Fixed.