From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6A8523858419; Wed, 23 Aug 2023 07:55:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6A8523858419 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1692777348; bh=QcR4mAD5xeGSrgZkI7McO6TlSRKvhcKasGuvfRaNLWs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bbllG24hrMJVAeWiwfL/hp+n2d/6UXu/PeMbvwTj/Nt2bwznODEzl/t+1b7QFvI3R liGML3KPK/B93pK/bPnQXcKI+3+Yh05EnXoUx4l7W38H5rICEGkRdP9ZpGQAmfCTTz tP2nscK6LC+f9wLSMNjJz9+VU7Ipvp2gspiSXAhA= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/111107] i686-w64-mingw32 does not realign stack when __attribute__((aligned)) or __attribute__((vector_size)) are used Date: Wed, 23 Aug 2023 07:55:47 +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: 12.2.0 X-Bugzilla-Keywords: ABI, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111107 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |10walls at gmail dot com --- Comment #5 from Richard Biener --- I'd say that config/i386/cygming.h:#define STACK_REALIGN_DEFAULT TARGET_SSE is a non-working "fix". The appropriate default would be -mincoming-stack-boundary=3D2. MIN_STACK_BOUNDARY should already be 4, so = that leaves PREFERRED_STACK_BOUNDARY_DEFAULT is the way to go here. I also see /* It should be MIN_STACK_BOUNDARY. But we set it to 128 bits for both 32bit and 64bit, to support codes that need 128 bit stack alignment for SSE instructions, but can't realign the stack. */ #define PREFERRED_STACK_BOUNDARY_DEFAULT \ (TARGET_IAMCU ? MIN_STACK_BOUNDARY : 128) which suggests there might be problems with SSE anyway. So does the following work? diff --git a/gcc/config/i386/cygming.h b/gcc/config/i386/cygming.h index d539f8d0699..e8db548510b 100644 --- a/gcc/config/i386/cygming.h +++ b/gcc/config/i386/cygming.h @@ -31,10 +31,9 @@ along with GCC; see the file COPYING3. If not see #undef MAX_STACK_ALIGNMENT #define MAX_STACK_ALIGNMENT (TARGET_SEH ? 128 : MAX_OFILE_ALIGNMENT) -/* 32-bit Windows aligns the stack on a 4-byte boundary but SSE instructio= ns - may require 16-byte alignment. */ -#undef STACK_REALIGN_DEFAULT -#define STACK_REALIGN_DEFAULT TARGET_SSE +/* 32-bit Windows aligns the stack on a 4-byte boundary. */ +#undef PREFERRED_STACK_BOUNDARY_DEFAULT +#define PREFERRED_STACK_BOUNDARY_DEFAULT (TARGET_64BIT ? 128 : 32) /* Support hooks for SEH. */ #undef TARGET_ASM_UNWIND_EMIT=