https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91779
Bug ID: 91779 Summary: [9 regression] Unbalanced stack manipulation Product: gcc Version: 9.2.1 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: sch...@linux-m68k.org Target Milestone: --- Target: i586-*-* Created attachment 46887 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46887&action=edit Preprocessed input When compiled with -m32 -O2, the first call to _fprintf in main _fprintf(out,"->{'%c'}\n",Cr.x); saves the format string on the stack at $fp-100: pushl %eax leal .LC164@GOTOFF(%ebx), %eax pushl %eax pushl (%esi) movl %eax, -100(%ebp) call _fprintf This is then reused by the second call: pushl %eax pushl -100(%ebp) pushl (%esi) call _fprintf but here pushl %eax overwrites the value in $fp-100. The bug appears to be here (after first call to fflush): pushl (%esi) call fflush@PLT leal -84(%ebp), %eax popl %edx popl %ecx The second popl is causing a stack frame underflow.