aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorRichard Biener <rguenth@gcc.gnu.org>2009-04-05 19:50:28 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-04-05 19:50:28 +0000
commit941c3614de1559c71cd1dc4f15d888d2bcccbd63 (patch)
tree6c1b02c0fcfd2169d3672a32b8b6061b7ad36315 /gcc/tree-ssa-sccvn.c
parent435970ad3e6e2d61767b8d992242cb4baa08b7e3 (diff)
downloadgcc-941c3614de1559c71cd1dc4f15d888d2bcccbd63.zip
gcc-941c3614de1559c71cd1dc4f15d888d2bcccbd63.tar.gz
gcc-941c3614de1559c71cd1dc4f15d888d2bcccbd63.tar.bz2
re PR c/39648 (internal compiler error: in fold_convert, at fold-const.c:2506)
2009-04-05 Richard Guenther <rguenther@suse.de> PR tree-optimization/39648 * tree-ssa-sccvn.c (vn_reference_fold_indirect): Work around our &A vs. &A[0] IL deficiencies. * gcc.c-torture/compile/pr39648.c: New testcase. From-SVN: r145569
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 729787b..2982e8c 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -757,6 +757,23 @@ vn_reference_fold_indirect (VEC (vn_reference_op_s, heap) **ops,
/* Get ops for the addressed object. */
op = VEC_index (vn_reference_op_s, *ops, i);
+ /* ??? If this is our usual typeof &ARRAY vs. &ARRAY[0] problem, work
+ around it to avoid later ICEs. */
+ if (TREE_CODE (TREE_TYPE (TREE_OPERAND (op->op0, 0))) == ARRAY_TYPE
+ && TREE_CODE (TREE_TYPE (TREE_TYPE (op->op0))) != ARRAY_TYPE)
+ {
+ vn_reference_op_s aref;
+ tree dom;
+ aref.type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (op->op0)));
+ aref.opcode = ARRAY_REF;
+ aref.op0 = integer_zero_node;
+ if ((dom = TYPE_DOMAIN (TREE_TYPE (TREE_OPERAND (op->op0, 0))))
+ && TYPE_MIN_VALUE (dom))
+ aref.op0 = TYPE_MIN_VALUE (dom);
+ aref.op1 = NULL_TREE;
+ aref.op2 = NULL_TREE;
+ VEC_safe_push (vn_reference_op_s, heap, mem, &aref);
+ }
copy_reference_ops_from_ref (TREE_OPERAND (op->op0, 0), &mem);
/* Do the replacement - we should have at least one op in mem now. */