public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug target/65146] alignment of _Atomic structure member is not correct Date: Wed, 26 Aug 2020 16:03:25 +0000 [thread overview] Message-ID: <bug-65146-4-Ah50jkLWAK@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-65146-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65146 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |uros at gcc dot gnu.org --- Comment #21 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, are we talking about something like (no -Wpsabi here) --- gcc/config/i386/i386.c.jj 2020-08-24 10:00:01.321258451 +0200 +++ gcc/config/i386/i386.c 2020-08-26 17:54:39.089468108 +0200 @@ -16487,7 +16487,11 @@ iamcu_alignment (tree type, int align) /* Intel MCU psABI specifies scalar types > 4 bytes aligned to 4 bytes. */ - mode = TYPE_MODE (strip_array_types (type)); + type = strip_array_types (type); + if (TYPE_ATOMIC (type)) + return align; + + mode = TYPE_MODE (type); switch (GET_MODE_CLASS (mode)) { case MODE_INT: @@ -16757,7 +16761,7 @@ ix86_minimum_alignment (tree exp, machin /* Don't do dynamic stack realignment for long long objects with -mpreferred-stack-boundary=2. */ if ((mode == DImode || (type && TYPE_MODE (type) == DImode)) - && (!type || !TYPE_USER_ALIGN (type)) + && (!type || (!TYPE_USER_ALIGN (type) && !TYPE_ATOMIC (type))) && (!decl || !DECL_USER_ALIGN (decl))) { gcc_checking_assert (!TARGET_STV); @@ -20293,7 +20297,10 @@ x86_field_alignment (tree type, int comp return computed; if (TARGET_IAMCU) return iamcu_alignment (type, computed); - mode = TYPE_MODE (strip_array_types (type)); + type = strip_array_types (type); + if (TYPE_ATOMIC (type)) + return computed; + mode = TYPE_MODE (type); if (mode == DFmode || mode == DCmode || GET_MODE_CLASS (mode) == MODE_INT || GET_MODE_CLASS (mode) == MODE_COMPLEX_INT) No idea whether we need the ix86_minimum_alignment change and about IAMCU I'll defer to H.J., but the last hunk fixes something like #c1 or struct A { char a; _Atomic long long b; }; struct B { char a; _Atomic double b; }; int a = __builtin_offsetof (struct A, b); int b = __builtin_offsetof (struct B, b); with -m32 for me.
next prev parent reply other threads:[~2020-08-26 16:03 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-02-20 19:58 [Bug c/65146] New: " alexey.lapshin at oracle dot com 2015-02-20 21:43 ` [Bug c/65146] " joseph at codesourcery dot com 2015-02-20 22:51 ` alexey.lapshin at oracle dot com 2015-02-20 23:32 ` joseph at codesourcery dot com 2020-08-26 14:59 ` [Bug target/65146] " jason at gcc dot gnu.org 2020-08-26 16:03 ` jakub at gcc dot gnu.org [this message] 2020-08-26 17:33 ` jakub at gcc dot gnu.org 2020-08-26 17:58 ` hjl.tools at gmail dot com 2020-08-27 16:45 ` cvs-commit at gcc dot gnu.org 2022-04-27 12:37 ` peter at cordes dot ca 2023-12-04 10:10 ` egallager at gcc dot gnu.org
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-65146-4-Ah50jkLWAK@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).