https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101062
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
And
union U { signed b : 5; };
int c;
volatile union U d[7] = {{8}};
short e = 1;
__attribute__((noipa, noinline, noclone)) void
foo ()
{
d[6].b = 0;
d[6].b = 0;
d[6].b = 0;
d[6].b = 0;
d[6].b = 0;
e = 0;
c = 0;
}
int
main ()
{
foo ();
if (e != 0)
__builtin_abort ();
return 0;
}
it started even in between r0-74314-gc245c134da2fdced8608d3e992c969ae22932752
and r0-74353-g5cd88d6857dffe4f10c834c773c300881ec20e32
Seems the problem is the d[6].b store, which incorrectly uses a 64-bit load
from d+24 and then later on stores adjusted value to that. But d is only 28
bytes long and with -fno-toplevel-reorder the e variable is right after it and
scheduling moves the load from *(long long *)(((char *)&d) + 24) before store
to e and its update after store to e.