This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: -fomit-frame-pointer interaction with alloca - egcs-1.0.1




  In message <01BD325D.B623F8C0@malvinas.AtlanTech.COM>you write:
  > The "-fomit-frame-pointer" option interacts poorly with alloca.
  > 
  > If a function contains a call to alloca then -fomit-frame-pointer seems to
  > get turned off.
  > 
  > This is a pity.
  > 
  > What's worse is that some parts of egcs don't seem to know and carry on as
  > if -fomit-frame pointer was still in effect, generating unnecessary stack
  > pointer manipulations.
It's not really feasible to do either optimziation you've requested.

alloca'd memory is not released until the end of a function, and in general
you don't know much memory was alloca'd.  Thus you must have a frame pointer
so that you can correctly restore the stack pointer.

If you tried to release alloca'd memory in the middle of a function you'd
probably find out that you'd need a frame pointer at each program join
point.



jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]