https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61222
Bug ID: 61222 Summary: ICE on valid code at -O2 and -O3 on x86_64-linux-gnu in decompose, at rtl.h:1456 Product: gcc Version: 4.10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu The following code causes an ICE when compiled with the current gcc trunk at -O2 and -O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes. It is a regression from 4.9.x. $ gcc-trunk -v Using built-in specs. COLLECT_GCC=gcc-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.10.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc-trunk/configure --prefix=/usr/local/gcc-trunk --enable-languages=c,c++ --disable-werror --enable-multilib Thread model: posix gcc version 4.10.0 20140518 (experimental) [trunk revision 210581] (GCC) $ $ gcc-trunk -Os small.c; a.out $ gcc-4.9.0 -O2 small.c; a.out $ $ gcc-trunk -O2 small.c small.c: In function ‘foo’: small.c:16:1: internal compiler error: in decompose, at rtl.h:1456 } ^ 0x9725a8 wi::int_traits<std::pair<rtx_def*, machine_mode> >::decompose(long*, unsigned int, std::pair<rtx_def*, machine_mode> const&) ../../gcc-trunk/gcc/rtl.h:1454 0x96ade9 wi::int_traits<std::pair<rtx_def*, machine_mode> >::decompose(long*, unsigned int, std::pair<rtx_def*, machine_mode> const&) ../../gcc-trunk/gcc/rtl.h:1454 0x96ade9 wide_int_ref_storage<std::pair<rtx_def*, machine_mode> > ../../gcc-trunk/gcc/wide-int.h:959 0x96ade9 generic_wide_int<std::pair<rtx_def*, machine_mode> > ../../gcc-trunk/gcc/wide-int.h:735 0x96ade9 sub<std::pair<rtx_def*, machine_mode>, std::pair<rtx_def*, machine_mode> > ../../gcc-trunk/gcc/wide-int.h:2349 0x96ade9 simplify_const_binary_operation(rtx_code, machine_mode, rtx_def*, rtx_def*) ../../gcc-trunk/gcc/simplify-rtx.c:3732 0xe6d2eb simplify_shift_const_1 ../../gcc-trunk/gcc/combine.c:10352 0xe6d625 simplify_shift_const ../../gcc-trunk/gcc/combine.c:10526 0xe7567d combine_simplify_rtx ../../gcc-trunk/gcc/combine.c:5873 0xe77a8a subst ../../gcc-trunk/gcc/combine.c:5170 0xe752ab combine_simplify_rtx ../../gcc-trunk/gcc/combine.c:5250 0xe77a8a subst ../../gcc-trunk/gcc/combine.c:5170 0xe777a8 subst ../../gcc-trunk/gcc/combine.c:5115 0xe777a8 subst ../../gcc-trunk/gcc/combine.c:5115 0xe777a8 subst ../../gcc-trunk/gcc/combine.c:5115 0xe78d7e try_combine ../../gcc-trunk/gcc/combine.c:3138 0xe7eab3 combine_instructions ../../gcc-trunk/gcc/combine.c:1370 0xe7eab3 rest_of_handle_combine ../../gcc-trunk/gcc/combine.c:13865 0xe7eab3 execute ../../gcc-trunk/gcc/combine.c:13909 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. $ -------------------------- int a, b, d, e; char c; void foo () { for (; a; a++) { d = ((b == 0) ^ (129 + a)); c = d * 9; e = c < 1; if (e) for (;;) ; } } int main () { foo (); return 0; }