https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61385
Bug ID: 61385 Summary: ICE on valid code at -O2 and -O3 on x86_64-linux-gnu Product: gcc Version: unknown 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 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 20140601 (experimental) [trunk revision 211115] (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 ‘fn1’: small.c:6:1: internal compiler error: Segmentation fault fn1 () ^ 0x98642f crash_signal ../../gcc-trunk/gcc/toplev.c:337 0x7a0c09 is_gimple_val(tree_node*) ../../gcc-trunk/gcc/gimple-expr.c:814 0x9aa66d verify_gimple_assign_binary ../../gcc-trunk/gcc/tree-cfg.c:3582 0x9b5aff verify_gimple_in_cfg(function*, bool) ../../gcc-trunk/gcc/tree-cfg.c:4889 0x8cdc5e execute_function_todo ../../gcc-trunk/gcc/passes.c:1777 0x8ce4a3 execute_todo ../../gcc-trunk/gcc/passes.c:1834 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. $ -------------------------- #include <assert.h> int a, b, c, d, e, f, g; int fn1 () { int *h = &c; for (; c < 1; c++) { int *i = &a, *k = &a; f = 0; if (b) return 0; if (*h) { int **j = &i; *j = 0; d = 0; } else g = e = 0; if (*h) { int **l = &k; *l = &g; } d &= *h; assert (k == &a || k); assert (i); } return 0; } int main () { fn1 (); return 0; }