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/109661] [13/14 Regression] ICE in aarch64_function_arg_alignment when building erlang
Date: Fri, 28 Apr 2023 08:44:26 +0000	[thread overview]
Message-ID: <bug-109661-4-R1IDbR7xCx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109661-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Untested fix:

2023-04-28  Jakub Jelinek  <jakub@redhat.com>

        PR target/109661
        * config/aarch64/aarch64.cc (aarch64_function_arg_alignment): For
        ENUMERAL_TYPEs use alignment of TYPE_MAIN_VARIANT (TREE_TYPE (type))
        rather than TYPE_MAIN_VARIANT (type).

        * g++.dg/other/pr109661.C: New test.

--- gcc/config/aarch64/aarch64.cc.jj    2023-04-24 14:54:45.558075512 +0200
+++ gcc/config/aarch64/aarch64.cc       2023-04-28 10:37:58.013311653 +0200
@@ -7487,6 +7487,9 @@ aarch64_function_arg_alignment (machine_

   if (!AGGREGATE_TYPE_P (type))
     {
+      /* For enumeral types use the underlying type if possible.  */
+      if (TREE_CODE (type) == ENUMERAL_TYPE && TREE_TYPE (type))
+       type = TREE_TYPE (type);
       /* The ABI alignment is the natural alignment of the type, without
         any attributes applied.  Normally this is the alignment of the
         TYPE_MAIN_VARIANT, but not always; see PR108910 for a counterexample.
--- gcc/testsuite/g++.dg/other/pr109661.C.jj    2023-04-28 10:41:21.169350306
+0200
+++ gcc/testsuite/g++.dg/other/pr109661.C       2023-04-28 10:40:46.246859362
+0200
@@ -0,0 +1,12 @@
+// PR target/109661
+// { dg-do compile { target c++11 } }
+// { dg-options "-w" } */
+
+typedef unsigned long U __attribute__ ((aligned (128)));
+typedef enum : U { V = 0 } W;
+
+U
+foo (U a, W b)
+{
+  return a + U (b);
+}

The question is if it is an ABI change from GCC 12 or not (GCC 13 ICEs on it,
so ABI doesn't matter).

  parent reply	other threads:[~2023-04-28  8:44 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28  8:18 [Bug target/109661] New: " jakub at gcc dot gnu.org
2023-04-28  8:18 ` [Bug target/109661] " jakub at gcc dot gnu.org
2023-04-28  8:19 ` jakub at gcc dot gnu.org
2023-04-28  8:28 ` jakub at gcc dot gnu.org
2023-04-28  8:44 ` jakub at gcc dot gnu.org [this message]
2023-04-28  8:56 ` rsandifo at gcc dot gnu.org
2023-04-28  8:56 ` rsandifo at gcc dot gnu.org
2023-05-02 11:29 ` jakub at gcc dot gnu.org
2023-05-02 11:50 ` rsandifo at gcc dot gnu.org
2023-05-03 16:44 ` cvs-commit at gcc dot gnu.org
2023-05-03 16:44 ` cvs-commit at gcc dot gnu.org
2023-05-03 16:49 ` [Bug target/109661] [13 " rsandifo at gcc dot gnu.org
2023-05-09 12:18 ` sjames at gcc dot gnu.org
2023-05-11 11:36 ` cvs-commit at gcc dot gnu.org
2023-07-19 11:24 ` rguenth 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-109661-4-R1IDbR7xCx@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).