diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-05 19:50:28 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-04-05 19:50:28 +0000 |
commit | eb04d2ded6999d6662bc1efe4bed158072773ca8 (patch) | |
tree | 6c1b02c0fcfd2169d3672a32b8b6061b7ad36315 /gcc/tree-ssa-sccvn.c | |
parent | 0db3c7348d1a91fbf5c56aa6757e80c33ed0ba49 (diff) | |
download | gcc-eb04d2ded6999d6662bc1efe4bed158072773ca8.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@145569 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 729787be3f7..2982e8ca051 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. */ |