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]
Other format: [Raw text]

[Bug rtl-optimization/9624] Stack space allocation too gratuitious


------- Additional Comments From bisqwit at iki dot fi  2004-09-08 11:29 -------
Alignment indeed rounds up the size, but consider this code:
  void xxx(void)
  {
      unsigned x[12451];
  }
No matter which optimization settings you run it at (even with
-fomit-frame-pointer), gcc will still emit code that allocates 49804+ bytes from
stack and immediately releases it. On x86, for example, it does this:
  _Z3xxxv:
      subl $49820, %esp
      addl $49820, %esp
      ret

Same thing also happens for unused local structs and classes.
The stack space isn't freed.

This does not happen with simple variables (ints and such), probably because the
compiler treats them as register variables by default and only allocates stack
space when it has no other choice.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=9624


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