PR middle-end/51510
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Dec 2011 16:44:23 +0000 (16:44 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Dec 2011 16:44:23 +0000 (16:44 +0000)
* calls.c (internal_arg_pointer_based_exp_scan): Don't use
VEC_safe_grow_cleared if idx is smaller than VEC_length.

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

gcc/ChangeLog
gcc/calls.c

index d02c8df..88b45d8 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/51510
+       * calls.c (internal_arg_pointer_based_exp_scan): Don't use
+       VEC_safe_grow_cleared if idx is smaller than VEC_length.
+
 2011-12-12  Richard Sandiford  <richard.sandiford@linaro.org>
 
        PR middle-end/50873
index 95369b7..0ef0cad 100644 (file)
@@ -1705,9 +1705,11 @@ internal_arg_pointer_based_exp_scan (void)
            val = internal_arg_pointer_based_exp (SET_SRC (set), false);
          if (val != NULL_RTX)
            {
-             VEC_safe_grow_cleared (rtx, heap,
-                                    internal_arg_pointer_exp_state.cache,
-                                    idx + 1);
+             if (idx
+                 >= VEC_length (rtx, internal_arg_pointer_exp_state.cache))
+               VEC_safe_grow_cleared (rtx, heap,
+                                      internal_arg_pointer_exp_state.cache,
+                                      idx + 1);
              VEC_replace (rtx, internal_arg_pointer_exp_state.cache,
                           idx, val);
            }