[Bug rtl-optimization/40838] gcc shouldn't assume that the stack is aligned
harald at gigawatt dot nl
gcc-bugzilla@gcc.gnu.org
Sat May 5 18:59:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838
Harald van Dijk <harald at gigawatt dot nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |harald at gigawatt dot nl
--- Comment #90 from Harald van Dijk <harald at gigawatt dot nl> ---
Given how many years have passed I expect it's too late for anything to change,
but for completeness:
Assuming the stack is aligned breaks existing binaries compiled with old GCC
versions, and with GCC 8 this becomes far more visible. Minimal test case:
compile
void exit(int);
int main(void) { exit(0); }
with GCC 2.8, compile current glibc with GCC 8, and there will be a segfault in
glibc's __run_exit_handlers because GCC 2.8 never kept the stack
16-byte-aligned, but GCC 8 does now generate code which assumes it.
Yes, I've actually been running GCC 2.8-compiled binaries that have only now
become broken as a result of this. This is not hypothetical. For the moment,
I've rebuilt glibc with -mincoming-stack-boundary=2 to handle the problem well
enough for my current needs, but it's not a complete solution.
More information about the Gcc-bugs
mailing list