[Bug tree-optimization/23086] incomming arguments cannot alias local variables

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Apr 3 12:20:00 GMT 2009



------- Comment #10 from rguenth at gcc dot gnu dot org  2009-04-03 12:19 -------
  *a = 1;  <--- a cannot point to b here.
  if (b == 2)

b != 2 you mean.

This works for me with 4.0.4 even.  Likely optimized on RTL level?

Adjusted testcase:

extern void link_error (void);
extern void abort (void);

int *t;
int __attribute__((noinline)) g(int *a)
{
  t = a;
  *a = 2;
}

void __attribute__((noinline)) f(int *a)
{
  int b;
  b = 1;
  g(&b);
  b = 2;
  *a = 1;
  if (b != 2)
    link_error();
}

int main(void)
{
  int t;
  f(&t);
  if (t != 1)
    abort ();
  return 0;
}


On trunk we now have

f (int * a)
{
  int b;

<bb 2>:
  b = 1;
  g (&b);
  *a = 1;
  return;

}


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|                            |4.4.0
         Resolution|                            |FIXED
   Target Milestone|---                         |4.5.0


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



More information about the Gcc-bugs mailing list