GCC/assembly question

Michael Meissner gcc-help@the-meissners.org
Thu Jun 19 18:43:00 GMT 2003

On Thu, Jun 19, 2003 at 12:15:46PM -0400, Diego Figueroa wrote:
> Is there a reasoning behind this? I don't understand if those things are
> intentional? Even when the code is optimized I still get the
> 'subl $8, %esp' instruction that I can't figure out.

It comes from the following in gcc/config/i386/i386.h:

/* As of July 2001, many runtimes to not align the stack properly when
   entering main.  This causes expand_main_function to forcibly align
   the stack, which results in aligned frames for functions called from
   main, though it does nothing for the alignment of main itself.  */
  (ix86_preferred_stack_boundary > STACK_BOUNDARY && !TARGET_64BIT)

If you had picked some other function than "main" and used -O2
-fomit-frame-pointer, you wouldn't see any additional code.

Michael Meissner
email: gnu@the-meissners.org

More information about the Gcc-help mailing list