Hi!

When idx is smaller than VEC_length (which happens when some pseudo
is set more than once in the tail call sequence), we should try to grow
the vector to smaller size than it has.

Bootstrapped/regtested on x86_64-linux and i686-linux, tested in arm cross
on the testcase mentioned in the PR with -march=iwmmxt -O2, commited
to trunk as obvious.  Will backport to 4.6 soon.

2011-12-12  Jakub Jelinek  <ja...@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.

--- gcc/calls.c.jj      2011-12-08 16:36:42.000000000 +0100
+++ gcc/calls.c 2011-12-12 09:59:26.543358601 +0100
@@ -1705,9 +1705,11 @@ internal_arg_pointer_based_exp_scan (voi
            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);
            }

        Jakub

Reply via email to