From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CA4023858C66; Fri, 28 Apr 2023 08:44:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CA4023858C66 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682671468; bh=QK1fos1Oq8VcPVVrttnNMdnjIlgAb1mtv0wcecIALLY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=R1701hrl2/2zpElQr24nte3dU8Q0KzXgP5pqvYxlv90APuFM1ZRfS3eNj15fAlXZ6 sfCr5Fmq4iHGWodNa2lDRfd8mbiu8R4M8wgp1V1F5BtwTSADmxFdbofcDypO2VGUDW hvK9qyF8p9hqIf52xfV2Ule6+YMvfU6OvnNETPYE= From: "jakub at gcc dot 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D109661 --- Comment #3 from Jakub Jelinek --- Untested fix: 2023-04-28 Jakub Jelinek 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) =3D=3D ENUMERAL_TYPE && TREE_TYPE (type)) + type =3D 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 counterexamp= le. --- gcc/testsuite/g++.dg/other/pr109661.C.jj 2023-04-28 10:41:21.1693503= 06 +0200 +++ gcc/testsuite/g++.dg/other/pr109661.C 2023-04-28 10:40:46.2468593= 62 +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 =3D 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 i= t, so ABI doesn't matter).=