OSDN Git Service

* tree-ssa-sccvn.c (vn_reference_lookup_3): Don't assume there are
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Sep 2009 18:35:24 +0000 (18:35 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 8 Sep 2009 18:35:24 +0000 (18:35 +0000)
        more VR->OPERANDS than LHS operands.  Free LHS before returning.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151530 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree-ssa-sccvn.c

index c41d08d..6ed406a 100644 (file)
        (remove_from_deps): Also remove calls from
        last_function_call_may_noreturn list.
 
+2009-09-07  Richard Henderson  <rth@redhat.com>
+
+       * tree-ssa-sccvn.c (vn_reference_lookup_3): Don't assume there are
+       more VR->OPERANDS than LHS operands.  Free LHS before returning.
+
 2009-09-07  Bernd Schmidt  <bernd.schmidt@analog.com>
 
        * config/bfin/bfin.md (UNSPEC_VOLATILE_STALL): New constant.
index 3d814fc..255e8a5 100644 (file)
@@ -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);