http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59592
Bug ID: 59592 Summary: Segmentation fault in fold_comparison at -O1 Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: antoine.balestrat at gmail dot com Hello ! The following testcase makes GCC 4.9.0 as of 20131224 segfault at -O1. $ cat seg.c long a, b; void f(void) { if(0) { int c, d; lbl1: for(c = 0; c < 1; c++) for(b = 0; b < 1;); d %= d; lbl2: d ? : 1; } if(a++) goto lbl1; int e = 1; if((a ^= a ? : 0) < (e && (e %= e))) goto lbl2; int *p = &e; } $ xgcc -O1 seg.c seg.c: In function âfâ: seg.c:26:1: internal compiler error: Segmentation fault } ^ 0x9d80bf crash_signal ../../srcdir/gcc/toplev.c:336 0x79a239 fold_comparison ../../srcdir/gcc/fold-const.c:9078 0x7a318b fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*, tree_node*) ../../srcdir/gcc/fold-const.c:12953 0xa0fe01 cleanup_control_expr_graph ../../srcdir/gcc/tree-cfgcleanup.c:112 0xa0fe01 cleanup_control_flow_bb ../../srcdir/gcc/tree-cfgcleanup.c:187 0xa0fe01 cleanup_tree_cfg_bb ../../srcdir/gcc/tree-cfgcleanup.c:605 0xa118a8 cleanup_tree_cfg_1 ../../srcdir/gcc/tree-cfgcleanup.c:650 0xa118a8 cleanup_tree_cfg_noloop ../../srcdir/gcc/tree-cfgcleanup.c:706 0xa118a8 cleanup_tree_cfg() ../../srcdir/gcc/tree-cfgcleanup.c:761 0x92e1d4 execute_function_todo ../../srcdir/gcc/passes.c:1808 0x92eab3 execute_todo ../../srcdir/gcc/passes.c:1884 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.