Jump to content
  • Advertisement
Sign in to follow this  
DaBono

Omitting frame pointer

This topic is 4637 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In the release builds of my program I give gcc the -fomit-frame-pointer option. However, lately I noticed that - whenever an exception is thrown - I get a segmentation fault. The gcc man-page says about this option that it omits the frame pointer '...for functions that don’t need one.', which sounds pretty safe to me. When I compile without the option (but with -momit-leaf-frame-pointer) everything works fine. Could someone explain this behaviour to me? Is my code broken, or am I doing something I shouldn't?

Share this post


Link to post
Share on other sites
Advertisement
Are you also passing -fexceptions (I think that's right command) to gcc. by default it doesn't use execption handling (that may be different with some newer versions). So you have to enable it.

Share this post


Link to post
Share on other sites
I'm using gcc 4.0.1, which now indeed has exception handling on by default. I tried to specify -fexceptions specifically, but als to no avail.
Thanks for the suggestion, though.

Share this post


Link to post
Share on other sites
Does it crash with a simple test program? Does the optimization flag affect its crashing (or what flags are you passing it)?

Share this post


Link to post
Share on other sites
Assuming an x86 cpu, my guess is that the exception frame is built in a way that assumes the presence of a stack frame. So when the stack frame is omitted and an exception occurs, you get another exception when the exception handler for the first exception attempts to reference a non existent stack frame and the exception inside the exception begats the seg fault. Are you running Windows?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!