https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91665

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #4)
> int val[1024];
> void
> foo (int n)
> {
>   int i;
>   for (int j = 0, i = n; j < 1024; ++j, i=(unsigned)i+1)
>     val[j] = i;
> }
> 
> generates signed add for the induction vectorization.

And the problematic part is likely not the vector code but the init vector
compute which uses signed values as well:

  <bb 2> [local count: 10737418]:
  _12 = n_6(D) + 1;
  _11 = n_6(D) + 2;
  _5 = n_6(D) + 3;
  _4 = {n_6(D), _12, _11, _5};
  vect_cst__3 = { 4, 4, 4, 4 };

fortunately we don't (yet) derive ranges for n_6(D) after the adds otherwise
we'd miscompile, say

int val[1024];
void
foo (int n)
{
  int i;
  for (int j = 0, i = n; j < 1024; ++j, i=(unsigned)i+1)
    val[j] = i;
  if (n == __INT_MAX__)
    return;
  __builtin_abort ();
}

during late VRP.

Reply via email to