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

--- Comment #33 from Richard Biener <rguenth at gcc dot gnu.org> ---
Something like the following might be a testcase, needs -fno-tree-sra
but it fails to demonstrate the particular sub-field layout for Y.

struct X { int *p; int *q; };
struct Y { struct X a; struct { unsigned pad : 1; struct X b; } b; };
static int i, j, k, l;
int foo (int c)
{
  struct Y y;
  y.b.b.p = &i;
  y.b.b.q = &j;
  char *p = (char *)&y;
  struct X z;
  z = *(struct X *)(p + sizeof (struct X) + sizeof (unsigned));
  return *z.q;
}

so no nice small testcase for now.

Reply via email to