[Bug middle-end/38212] restrict implementation causes wrong-code

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



------- Comment #2 from rguenth at gcc dot gnu dot org  2008-11-21 15:28 -------
int __attribute__((noinline))
foo (int *__restrict p, int i)
{
  int *__restrict q = p + i;
  int v = *(p + i);
  *p = 1;
  return v + *q;
}
extern void abort (void);
int main()
{
  int i = 0;
  if (foo (&i, 0) != 1)
    abort ();
  return 0;
}

also breaks, even though *p and *(p + i) conflict we still CSE *q to be
equal to *(p + i) because we CSE p + i to be q which makes us go back
to square one.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |4.3.2 4.4.0


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



More information about the Gcc-bugs mailing list