https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88223

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hmm, and with unions we can break the TBAA rule.

union U {
  struct X { int a : 3; int b : 8; } a;
  struct Y { int a : 4; int b : 8; } b;
};

union U u;
int __attribute__((noinline)) bar ()
{
  int x = u.a.b;
  u.b.b = x;
  return u.a.b;
}

int main()
{
  u.a.b = 1;
  if (bar () != 3)
    abort ();
  return 0;
}

testcase is specific on bitfield layout of course and to the GCC extension
allowing type-punning via unions.

Reply via email to