The mainline compiler for sh4-*-linux-gnu fails during libgcc build: /exp/ldroot/dodes/xsh-gcc-orig/./gcc/xgcc -B/exp/ldroot/dodes/xsh-gcc-orig/./gcc/ -B/usr/local/sh4-unknown-linux-gnu/bin/ -B/usr/local/sh4-unknown-linux-gnu/lib/ -isystem /usr/local/sh4-unknown-linux-gnu/include -isystem /usr/local/sh4-unknown-linux-gnu/sys-include -O2 -O2 -g -O2 -DIN_GCC -DCROSS_COMPILE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -fpic -DNO_FPSCR_VALUES -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -I. -I. -I../../ORIG/trunk/gcc -I../../ORIG/trunk/gcc/. -I../../ORIG/trunk/gcc/../include -I../../ORIG/trunk/gcc/../libcpp/include -I../../ORIG/trunk/gcc/../libdecnumber -I../libdecnumber -DL_negvsi2 -fvisibility=hidden -DHIDE_EXPORTS -c ../../ORIG/trunk/gcc/libgcc2.c -o libgcc/./_negvsi2.o ../../ORIG/trunk/gcc/libgcc2.c: In function '__negvsi2': ../../ORIG/trunk/gcc/libgcc2.c:174: internal compiler error: in expand_compound_operation, at combine.c:5644
A reduced testcase is: void foo (int a) { int w = -a; if (a >= 0 ? w > 0 : w < 0) bar (); } which fails to compile with -O. This ICEs also on sh-elf with -O -m4. Binary search shows that it starts to fail after the patch: r109961 | bonzini | 2006-01-19 23:54:57 +0900 (Thu, 19 Jan 2006) | 13 lines 2006-01-19 Paolo Bonzini <[EMAIL PROTECTED]> * combine.c (try_combine): Do not worry about MEMs wrapped by USEs. (expand_compound_operation, expand_field_assignment): Fail if the bit lengths of an extract operation are out of range. (make_extraction): Compute wanted_inner_mode based on the position and length of the extraction. Make it extraction_mode for non-constant positions, and do not modify offset in that case. When generating a new MEM, use a mode that can hold the extraction while keeping correct alignment. Remove code that supported MEMs wrapped by USEs. (simplify_shift_const_1, force_to_mode) <case USE>: Remove. -- Summary: Bootstrap failure with ICE in expand_compound_operation Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: ice-on-valid-code, build, ice-checking Severity: normal Priority: P3 Component: target AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kkojima at gcc dot gnu dot org GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: sh4-*-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25919