http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59386
Bug ID: 59386 Summary: ICE on valid code at -O2 and -O3 on x86_64-linux-gnu in 64-bit mode Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-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 64-bit mode (but not in 32-bit mode). It is a regression from 4.8.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.9.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.9.0 20131204 (experimental) [trunk revision 205660] (GCC) $ $ gcc-trunk -m64 -Os -c small.c $ gcc-4.8 -m64 -O2 -c small.c $ gcc-trunk -m32 -O2 -c small.c $ $ gcc-trunk -m64 -O2 -c small.c small.c: In function ‘fn2’: small.c:31:1: error: incorrect sharing of tree nodes } ^ a.f2 # .MEM_11 = VDEF <.MEM_10> a.f2 = D.1782; small.c:31:1: internal compiler error: verify_gimple failed 0x9d3821 verify_gimple_in_cfg(function*) ../../gcc-trunk/gcc/tree-cfg.c:4848 0x8fa874 execute_function_todo ../../gcc-trunk/gcc/passes.c:1843 0x8fb273 execute_todo ../../gcc-trunk/gcc/passes.c:1877 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. $ --------------------------- struct S0 { int f0; }; struct S1 { int f1; struct S0 f2; } c; int b; struct S0 fn1 () { struct S1 d; if (b) for (; c.f1;) ; else return d.f2; } struct S0 fn2 () { struct S1 a; a.f2 = fn1 (); return a.f2; }