https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66412
Bug ID: 66412 Summary: ICE on valid code at -O2 and -O3 with -g enabled in simplify_subreg, at simplify-rtx.c:5748 Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The following code causes an ICE when compiled with the current gcc trunk at -O2 and -O3 with -g enabled on x86_64-linux-gnu in both 32-bit and 64-bit modes. This 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/6.0.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 6.0.0 20150603 (experimental) [trunk revision 224056] (GCC) $ $ gcc-trunk -O2 -c small.c $ gcc-trunk -Os -g -c small.c $ gcc-4.9.2 -O2 -g -c small.c $ $ gcc-trunk -O2 -g -c small.c small.c: In function ‘fn1’: small.c:12:1: internal compiler error: in simplify_subreg, at simplify-rtx.c:5743 } ^ 0xae6809 simplify_subreg(machine_mode, rtx_def*, machine_mode, unsigned int) ../../gcc-trunk/gcc/simplify-rtx.c:5742 0xae6bf9 simplify_gen_subreg(machine_mode, rtx_def*, machine_mode, unsigned int) ../../gcc-trunk/gcc/simplify-rtx.c:5962 0xae9176 simplify_replace_fn_rtx(rtx_def*, rtx_def const*, rtx_def* (*)(rtx_def*, rtx_def const*, void*), void*) ../../gcc-trunk/gcc/simplify-rtx.c:524 0xd9b7ef propagate_for_debug(rtx_insn*, rtx_insn*, rtx_def*, rtx_def*, basic_block_def*) ../../gcc-trunk/gcc/valtrack.c:210 0x106d801 try_combine ../../gcc-trunk/gcc/combine.c:4399 0x1071301 combine_instructions ../../gcc-trunk/gcc/combine.c:1324 0x1071301 rest_of_handle_combine ../../gcc-trunk/gcc/combine.c:14326 0x1071301 execute ../../gcc-trunk/gcc/combine.c:14369 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, c, d; void fn1 () { short e; for (c = 0; c < 1; c++) d = 0; unsigned short g = ((a == 0) ^ d) % 8; e = g << 1; b = e && 1; }