-fomit-frame-pointer interaction with alloca - egcs-1.0.1
Jeffrey A Law
law@cygnus.com
Sat Feb 7 23:31:00 GMT 1998
In message <01BD32F3.EF936D20@malvinas.AtlanTech.COM>you write:
>
> ------ =_NextPart_000_01BD32F3.EF9C94E0
> Content-Type: text/plain; charset="us-ascii"
> Content-Transfer-Encoding: 7bit
>
> John> My problem is that in the presence of [alloca] -fomit-frame-pointer
> John> generates WORSE code, instead of just being ignored.
>
> Jeffrey> Now that's a suprise!
>
> Here's one (small) example:
>
> int test (int p) {
> char *s = alloca (p);
> fred (s);
> return 1;
> }
>
> Note that the code with -fomit-frame-pointer (on the right) has an
> unnecessary "addl $4,%esp". Not a huge difference, but why?
Thanks for the testcase. Basically there's a test to determine when stack
adjustments can be ignored at function exit.
One of the tests includes a check to make sure a frame pointer will exist,
but it only checked that -fomit-frame-pointer was not specified -- ie it
didn't take into account that when a function calls alloca, it must always
have a frame pointer.
I've fixed this in the sources, so it should work as expected in the next
snapshot.
jeff
More information about the Gcc-bugs
mailing list