[Bug middle-end/37742] [4.4 Regression] ICE in vectorizer with restrict pointer

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Nov 21 11:11:00 GMT 2008



------- Comment #23 from rguenth at gcc dot gnu dot org  2008-11-21 11:09 -------
We actually usually never ask for the alias set of an indirect reference, but
instead we seem to use the pointed-to type instead which doesn't inherit the
restrict handling.  Otherwise we would miscompile even the trivial

int foo (int *__restrict p)
{
  int *__restrict q;
  int v;
  q = p + 1;
  q = q - 1;
  v = *q;
  *p = 1;
  return v + *q;
}
extern void abort (void);
int main()
{
  int i = 0;
  if (foo (&i) != 1)
    abort ();
  return 0;
}

because q is not based on the restrict p and both pointers would get
distinct alias-sets which you can verify by calling get_alias_set on
the indirect-refs.

So one way to fix the issue in the vectorizer is to avoid calling
get_alias_set on the indirect-refs as well.  Or to rip out all the
broken restrict handling from the compiler.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37742



More information about the Gcc-bugs mailing list