gcc forgets to decrease esp after function call

Andrew Haley aph@redhat.com
Thu Mar 15 11:32:00 GMT 2007

Vladimir Simonov writes:
 > The attached test case can be built by compile.sh.
 > It produces two binaries - test_bin_bad & test_bin_good.
 > test_bin_good prints "Hello word" before exit.
 > test_bin_bad crashes.
 > The difference is the only -O2 used while test_bin_bad build.
 > The symptoms are the same - incorrect esp usage in caller
 > after call function returning object.
 > We reproduced the bug in gcc 4.1.0/4.1.1/4.1.2
 > gcc 3.x can't compile the sources.

OK, we're getting closer.  Unfortunately, your test case includes a
ton of system headers for one particular system/version of gcc, and it
also includes a lot of library code not used in your test case.
Fillet that, and you will have a test case that can be submitted.


More information about the Gcc-help mailing list