https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61220
Bug ID: 61220 Summary: ICE on valid code at -O2 on x86_64-linux-gnu in maybe_record_trace_start, at dwarf2cfi.c:2239 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 on x86_64-linux-gnu in 64-bit mode (but not in 32-bit mode). 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 ‘main’: small.c:36:1: internal compiler error: in maybe_record_trace_start, at dwarf2cfi.c:2239 } ^ 0x68d049 maybe_record_trace_start ../../gcc-trunk/gcc/dwarf2cfi.c:2239 0x68d7b6 scan_trace ../../gcc-trunk/gcc/dwarf2cfi.c:2416 0x68df5a create_cfi_notes ../../gcc-trunk/gcc/dwarf2cfi.c:2570 0x68df5a execute_dwarf2_frame ../../gcc-trunk/gcc/dwarf2cfi.c:2925 0x68df5a execute ../../gcc-trunk/gcc/dwarf2cfi.c:3405 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, c, d, e, f, g, h, i, j, k; struct S0 { int f0; int f1; int f2; }; struct S1 { int f0; int f1; struct S0 f2; } b; void fn1 (struct S1 p) { for (; k; k++) h = j ? a : a - 1; d &= i; } int main () { int l[5] = { 0 }; fn1 (b); for (c = 0; c < 3; c++) for (g = 0; g < 3; g++) l[c * 2] = e = l[c]; if (f) fn1 (b); return 0; }