public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "gabrielopcode at gmail dot com" <gcc-bugzilla@gcc.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: Mon, 28 Aug 2023 18:28:14 +0000 [thread overview] Message-ID: <bug-111107-4-CjrGrMrIyV@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-111107-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111107 Gabriel Ivăncescu <gabrielopcode at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |gabrielopcode at gmail dot com --- Comment #7 from Gabriel Ivăncescu <gabrielopcode at gmail dot com> --- So to re-iterate summary of the problem: 1) The i686 Win32 ABI has a de-facto stack alignment of 4 bytes *only*. GCC may have set it to 16 bytes on Linux because it compiled the whole userland, but that's not the case on Windows; the caller can be MSVC compiled code (very likely on Windows) and MSVC only uses 4-byte alignment. 2) SSE is *not* the only thing that requires stack realignment. Sure, it does require it, but that's more a side effect of requiring larger-than-4 alignment in the first place. A variable (or its type) declared with __attribute__((aligned(...))) **should** also let GCC re-align the stack upon entry, if it's > 4 bytes and if it's actually used on the stack and spilled (or has its address taken). There's no reason to special-case SSE at all. It's just the alignment of the variable or spilled vector that should matter, and GCC must know that the incoming stack is aligned only to 4 bytes on this platform. i686 PE targets should simply default to -mincoming-stack-boundary=2 -mpreferred-stack-boundary=2 (the latter to minimize realignments unless necessary), as that's basically MSVC's behavior, and as such the de-facto standard on this platform.
next prev parent reply other threads:[~2023-08-28 18:28 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-08-22 21:27 [Bug target/111107] New: " zfigura at codeweavers dot com 2023-08-22 21:29 ` [Bug target/111107] " pinskia at gcc dot gnu.org 2023-08-22 21:41 ` zfigura at codeweavers dot com 2023-08-22 21:41 ` pinskia at gcc dot gnu.org 2023-08-22 21:56 ` zfigura at codeweavers dot com 2023-08-23 7:55 ` rguenth at gcc dot gnu.org 2023-08-24 20:29 ` zfigura at codeweavers dot com 2023-08-28 18:28 ` gabrielopcode at gmail dot com [this message] 2023-11-25 7:34 ` alexhenrie24 at gmail dot com 2023-11-25 8:57 ` amonakov at gcc dot gnu.org 2023-11-25 17:40 ` gabrielopcode at gmail dot com 2023-11-25 18:54 ` alexhenrie24 at gmail dot com 2023-11-25 19:20 ` alexhenrie24 at gmail dot com 2023-11-25 21:45 ` alexhenrie24 at gmail dot com 2023-11-28 22:34 ` ebotcazou at gcc dot gnu.org 2023-11-28 22:58 ` ebotcazou at gcc dot gnu.org 2023-11-29 3:54 ` zfigura at codeweavers dot com 2023-11-29 7:49 ` ebotcazou at gcc dot gnu.org 2023-11-29 19:05 ` zfigura at codeweavers dot com
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-111107-4-CjrGrMrIyV@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).