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 target/63890] [4.9/5 regression] Compiling trivial program with -O -p leads to misaligned stack


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63890

--- Comment #9 from mrs at gcc dot gnu.org <mrs at gcc dot gnu.org> ---
This is caused by:

--- ChangeLog   (revision 203170)
+++ ChangeLog   (revision 203171)
@@ -1,3 +1,8 @@
+2013-10-03  Jan Hubicka  <jh@suse.cz>
+
+       * i386.c (ix86_option_override_internal): Do not enable
+       accumulate-outgoing-args when producing unwind info.


Without saying if this is the right approach, I can just note that it works.

Index: config/i386/i386.h
===================================================================
--- config/i386/i386.h    (revision 220946)
+++ config/i386/i386.h    (working copy)
@@ -1606,7 +1606,7 @@ enum reg_class

 #define ACCUMULATE_OUTGOING_ARGS \
   ((TARGET_ACCUMULATE_OUTGOING_ARGS && optimize_function_for_speed_p (cfun)) \
-   || TARGET_STACK_PROBE || TARGET_64BIT_MS_ABI)
+   || TARGET_STACK_PROBE || TARGET_64BIT_MS_ABI || crtl->profile)

 /* If defined, a C expression whose value is nonzero when we want to use PUSH
    instructions to pass outgoing arguments.  */

The idea is, if mcount requires alignment of the stack, and outgoing arguments
is the only way to get that, then it would makes sense to have -p imply
outgoing arguments.

Previously on darwin we had flag_asynchronous_unwind_tables which turned on
target_flags |= MASK_ACCUMULATE_OUTGOING_ARGS, which ensured that
TARGET_ACCUMULATE_OUTGOING_ARGS was true which was enough to ensure that
ACCUMULATE_OUTGOING_ARGS was true.

If linux and all other x86 ports also needs stack alignment in mcount, then the
above should be correct.  If not, then darwin needs to ask specially, since no
one else does.


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