public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "iains at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/110044] [10, 11, 12, 13, 14 Regression] #pragma pack(push, 1) may not force packing, while __attribute__((packed, aligned(1))) works
Date: Wed, 31 May 2023 13:34:25 +0000	[thread overview]
Message-ID: <bug-110044-4-XD6Q3EoUo1@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110044-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #6 from Iain Sandoe <iains at gcc dot gnu.org> ---
I'm going to test the following (which will take some time since the hardware
is needed for testing releases too).

The test for AGGREGATE_TYPE_P() could actually be changed to
RECORD_OR_UNION_TYPE_P () - since the case that we might have an array is
handled for non-empty structs (but we do need to guard the empty struct case). 
The problem seems to be we were ignoring that the field type could be packed or
that there was a cap on the max alignment.

If it works as expected then I will apply to the open branches (hopefully
before 10.5 is spun).

----

diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 5b3b8b52e7e..e1c038da305 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -8209,7 +8209,8 @@ darwin_rs6000_special_round_type_align (tree type,
unsigned int computed,
       type = TREE_TYPE (type);
   } while (AGGREGATE_TYPE_P (type));

-  if (! AGGREGATE_TYPE_P (type) && type != error_mark_node)
+  if (type != error_mark_node && ! AGGREGATE_TYPE_P (type)
+      ! TYPE_PACKED(type) && maximum_field_alignment == 0)
     align = MAX (align, TYPE_ALIGN (type));

   return align;

  parent reply	other threads:[~2023-05-31 13:34 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 21:15 [Bug target/110044] New: " vital.had at gmail dot com
2023-05-30 22:14 ` [Bug target/110044] " pinskia at gcc dot gnu.org
2023-05-31  6:04 ` egallager at gcc dot gnu.org
2023-05-31  6:38 ` vital.had at gmail dot com
2023-05-31  8:22 ` iains at gcc dot gnu.org
2023-05-31  8:24 ` iains at gcc dot gnu.org
2023-05-31  8:34 ` [Bug target/110044] [10, 11, 12, 13, 14 Regression] " iains at gcc dot gnu.org
2023-05-31 13:34 ` iains at gcc dot gnu.org [this message]
2023-06-01  3:38 ` vital.had at gmail dot com
2023-06-02 19:04 ` [Bug target/110044] [10/11/12/13/14 " cvs-commit at gcc dot gnu.org
2023-06-09  8:39 ` [Bug target/110044] [10/11/12/13 " cvs-commit at gcc dot gnu.org
2023-06-09  8:39 ` cvs-commit at gcc dot gnu.org
2023-06-09  8:41 ` cvs-commit at gcc dot gnu.org
2023-06-09  8:41 ` cvs-commit at gcc dot gnu.org
2023-06-09  8:49 ` iains at gcc dot gnu.org
2023-06-09 22:56 ` vital.had at gmail 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-110044-4-XD6Q3EoUo1@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: link
Be 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).