------- Comment #4 from rguenth at gcc dot gnu dot org 2006-04-17 11:12 ------- 1329 aval[j] = get_val_for (op[j], val[j]); (gdb) call debug_generic_expr(val[0]) __builtin_pow (xD.1278_4, 2.0e+0) (gdb) call debug_generic_expr(op[0]) xD.1278_3
Program received signal SIGSEGV, Segmentation fault. 0x08316db6 in operand_equal_p (arg0=0xb7dc0798, arg1=0xb7c556c0, flags=0) at /space/rguenther/src/svn/gcc-4_1-branch/gcc/fold-const.c:2423 2423 if (TYPE_UNSIGNED (TREE_TYPE (arg0)) != TYPE_UNSIGNED (TREE_TYPE (arg1))) I think the brute-force evaluation should stop as soon as val[i] is no longer a constant. get_val_for (x=0xb7d3aea0, base=0xb7d39028) at /space/rguenther/src/svn/gcc-4_1-branch/gcc/tree-ssa-loop-niter.c:1242 1246 if (TREE_CODE (stmt) == PHI_NODE) (gdb) call debug_generic_expr(stmt) xD.1278_3 = __builtin_pow (xD.1278_4, 2.0e+0) (gdb) call debug_generic_expr(x) xD.1278_3 (gdb) call debug_generic_expr(base) __builtin_pow (xD.1278_4, 2.0e+0) now, stmt is the same as the stmt of the first use. get_val_for (x=0xb7d40104, base=0xb7d39028) at /space/rguenther/src/svn/gcc-4_1-branch/gcc/tree-ssa-loop-niter.c:1242 1242 if (!x) (gdb) finish Value returned is $11 = (union tree_node *) 0xb7d39028 (gdb) call debug_generic_expr($11) __builtin_pow (xD.1278_4, 2.0e+0) 1253 SET_USE (op, val); kaboom. We just created a self-referencing tree here. Now, either punt on non-constant/SSA_NAME val, or unshare val, or punt earlier. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27136