https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114552
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |13.3 Last reconfirmed| |2024-04-01 Summary|wrong code at -O1 and above |[13/14 Regression] wrong |on x86_64-linux-gnu |code at -O1 and above on | |x86_64-linux-gnu Component|tree-optimization |middle-end Status|UNCONFIRMED |NEW Target| |x86_64-linux-gnu Keywords| |needs-bisection, wrong-code Ever confirmed|0 |1 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Better reduced testcase, removing the pragma and putting the packed on the struct that is causing the issue: ``` struct a { short b; int c; }__attribute__((packed)); struct d { struct a b; int e; }; static const struct d k = {{1,0},0}; [[gnu::noinline]] void p() { asm("":::"memory"); } [[gnu::noinline]] void q(struct a n) { p(); } int main() { q(k.b); return 0; } ``` The bug is in the middle-end expanding the call `q(k.b);` such that k.b is on the stack but it messes up and uses the wrong size or something.