https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97164
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Reduced testcase for -O2:
typedef struct { int *a; char b[64]; } A __attribute__((aligned (64)));
struct B { A d[4]; } b;
void foo (void);
int *
bar (void)
{
struct B *h = &b;
if (h->d[1].a)
foo ();
return h->d[1].a;
}
Not really sure about the validity of the testcase (both original and reduced),
it works fine if one uses
typedef struct __attribute__((aligned (64))) A { int *a; char b[64]; } A;
instead. The problem is that above, the (anonymous) struct has different
alignment from the typedef and we end up using the type without the increased
alignment for one of those accesses.