aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2009-09-08 11:35:24 -0700
committerRichard Henderson <rth@gcc.gnu.org>2009-09-08 11:35:24 -0700
commit35ecd408840a3c34d580fcbc50d12561335c9f3d (patch)
tree063410287f85d829f224db16474ae551771ca2ef /gcc/tree-ssa-sccvn.c
parent3e5e84be5a2a8ecb0dc9db24593d4d586140cbec (diff)
downloadgcc-35ecd408840a3c34d580fcbc50d12561335c9f3d.zip
gcc-35ecd408840a3c34d580fcbc50d12561335c9f3d.tar.gz
gcc-35ecd408840a3c34d580fcbc50d12561335c9f3d.tar.bz2
tree-ssa-sccvn.c (vn_reference_lookup_3): Don't assume there are more VR->OPERANDS than LHS operands.
* tree-ssa-sccvn.c (vn_reference_lookup_3): Don't assume there are more VR->OPERANDS than LHS operands. Free LHS before returning. From-SVN: r151530
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 3d814fc..255e8a5 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1120,7 +1120,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_)
copy_reference_ops_from_ref (gimple_assign_lhs (def_stmt), &lhs);
i = VEC_length (vn_reference_op_s, vr->operands) - 1;
j = VEC_length (vn_reference_op_s, lhs) - 1;
- while (j >= 0
+ while (j >= 0 && i >= 0
&& vn_reference_op_eq (VEC_index (vn_reference_op_s,
vr->operands, i),
VEC_index (vn_reference_op_s, lhs, j)))
@@ -1128,13 +1128,14 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_)
i--;
j--;
}
+
+ VEC_free (vn_reference_op_s, heap, lhs);
/* i now points to the first additional op.
??? LHS may not be completely contained in VR, one or more
VIEW_CONVERT_EXPRs could be in its way. We could at least
try handling outermost VIEW_CONVERT_EXPRs. */
if (j != -1)
return (void *)-1;
- VEC_free (vn_reference_op_s, heap, lhs);
/* Now re-write REF to be based on the rhs of the assignment. */
copy_reference_ops_from_ref (gimple_assign_rhs1 (def_stmt), &rhs);