WRT http://gbenson.livejournal.com/2007/12/21/

GCC is being overzealous because of a default that was local to one file was
made global on 2003-10-07, and this changed the behavior of the #if statement
in explow.c's allocate_dynamic_stack_space():

#if defined (STACK_DYNAMIC_OFFSET) || defined (STACK_POINTER_OFFSET)
#define MUST_ALIGN 1
#else
#define MUST_ALIGN (PREFERRED_STACK_BOUNDARY < BIGGEST_ALIGNMENT)
#endif

Unfortunately, STACK_POINTER_OFFSET isn't a preprocessor constant on all ports.
 We could change the above to:

#if defined (STACK_DYNAMIC_OFFSET)
#define MUST_ALIGN 1
#else
#define MUST_ALIGN (STACK_POINTER_OFFSET || PREFERRED_STACK_BOUNDARY <
BIGGEST_ALIGNMENT)
#endif

but on at least one port (pa), STACK_POINTER_OFFSET depends on the size of the
outgoing arguments of a function, which we don't necessarily know yet at the
point we expand alloca builtins.  For pa, it's never zero, but for other ports
it might be, and then this would break.

BTW, function.c still provides a no-longer-necessary default for
STACK_POINTER_OFFSET.


-- 
           Summary: GCC generates too many alignment adds for alloca
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: regression
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aoliva at gcc dot gnu dot org


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

Reply via email to