[Bug tree-optimization/28807] [4.2 Regression] wrong code with may_alias and structs

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Aug 23 08:06:00 GMT 2006



------- Comment #5 from pinskia at gcc dot gnu dot org  2006-08-23 08:06 -------
(In reply to comment #4)
> This is a hard nut to crack, my *guess* is that if you just check the
> alias set of the type of the access, we are going to end up claiming any
> access to a structure containing a char variable is aliased.
You are correct as we regress with the following testcase:
struct a
{
  char a1;
};

int *aa;

void g(int *a)
{
  aa = a;
  *a = 2;
}

int t(int i, struct a *b)
{
  g(&i);
  b->a1 = 1;
  i = 2;
  if (b->a1 != 1)
    link_failure ();
}
int main(void)
{
  struct a b;
  t(1, &b);
  return 0;
}


-- 


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



More information about the Gcc-bugs mailing list