Hi,
this is testcase for unions.  It is somewhat artificial because
nonoverlapping_component_refs is conservative about matching union
fields and aliasing_component_refs_p resorts to offset/max_size
test which of course suceeds.
So I had to add the wrapping struct a (which is matched by
the earlier) and disambiguated.

ICC optimizes it as expected.

/* { dg-do compile } */
/* { dg-options "-O2 -fdump-tree-fre1" } */
struct a {int v1;
          int v2;};
struct b {int x; struct a a;};
struct c {struct a a;};
union d {struct b b; struct c c;};

int
test (union d *dptr1, union d *dptr2)
{
  dptr1->b.a.v1=123;
  dptr2->c.a.v2=1;
  return dptr1->b.a.v1;
}
/* { dg-final { scan-tree-dump-times "return 123" 1 "fre1"} } */

Reply via email to