From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 123907 invoked by alias); 25 Feb 2015 00:23:54 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 123825 invoked by uid 48); 25 Feb 2015 00:23:51 -0000 From: "mrs at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/63890] [4.9/5 regression] Compiling trivial program with -O -p leads to misaligned stack Date: Wed, 25 Feb 2015 02:16:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: mrs at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.9.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-02/txt/msg02727.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63890 --- Comment #9 from 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 + + * 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.