From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-DB5-obe.outbound.protection.outlook.com (mail-db5eur02on2067.outbound.protection.outlook.com [40.107.249.67]) by sourceware.org (Postfix) with ESMTPS id 04FC93858D38 for ; Wed, 11 Jan 2023 14:18:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 04FC93858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=arm.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MM4TjlEWaXShfk+NDTfK8iWqM+20KIjfFl0FpudPOHE=; b=RvRqFl/ZWPvh35zZjz5PrpOwj+WseBWFpN6fvyT27XIYBoDaY/aQrdah719RzRiNG1g+ln/CwiaTnD1Mvrc6laBgdgMWwAzCwLyXPy0CTEYEerRQ4FOWCAsFDvk+3jv+HGT/TBFcSwp9sxEsj/RTUmIzQaCfRfcvB47TYDEh9yQ= Received: from AS9PR04CA0155.eurprd04.prod.outlook.com (2603:10a6:20b:48a::29) by AM7PR08MB5350.eurprd08.prod.outlook.com (2603:10a6:20b:101::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Wed, 11 Jan 2023 14:18:37 +0000 Received: from AM7EUR03FT023.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:48a:cafe::cd) by AS9PR04CA0155.outlook.office365.com (2603:10a6:20b:48a::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.13 via Frontend Transport; Wed, 11 Jan 2023 14:18:36 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM7EUR03FT023.mail.protection.outlook.com (100.127.140.73) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18 via Frontend Transport; Wed, 11 Jan 2023 14:18:36 +0000 Received: ("Tessian outbound 333ca28169fa:v132"); Wed, 11 Jan 2023 14:18:36 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 1163b01f57aa37b5 X-CR-MTA-TID: 64aa7808 Received: from 9b4638004b6f.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 592E74D0-759F-4BF3-B74E-98B6E2C2408C.1; Wed, 11 Jan 2023 14:18:30 +0000 Received: from EUR04-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 9b4638004b6f.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Wed, 11 Jan 2023 14:18:30 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Ha3K8+xIkQM+Cc18ONzJyLFqM6eV6skQF8mMkXpGncWENEZpiMwmkJGH7gVj36ClPb7yH62pgWlvpcrh/cv96sbA3un/nQtOyni44e4rGlYOUkF+1FViAoW2EKeXpUJRNVeNv5zC4b0Qk+DEKYDT9hi4ymCHM+uSmGDS+FOcN5CVKBf1lak1dOg7SHVsMpaIXOeu9brCT6IQeU0pprjzWD5QT1/lMP+lOoRUBoRjVG+wQ2/YZnIk5NwnhlT2eKriqSHs+3dPkb9xfu7Q81dacHRK2a0wjTEU+/vhHHUs1zQhvU2uL8xbHHMIQbn/gtZ1n/e46hjVQXQMWoCa0hBtvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=MM4TjlEWaXShfk+NDTfK8iWqM+20KIjfFl0FpudPOHE=; b=dOR45be3IsXLkQPinDOFiK9aWDFwUATSXdJ3KBcXp5OtvEoh7d96sf7mDHGlS2UCcAlqgtHFF0DgmHwsrJtsCPADk2uoAKIIm7+lTtSeg/Scs5xzl6EQ2LjoJMs974BNgSMrKMkIVgXz4vPk4bEozn4euW6x590lIhFmhiuvsjzzw2RzqvsMfeuhFPeFxh9ap6jCNwodcOWSsm8ycz2HRXY7BEUDMOVgvxOUUi5VVqmVWbEj41BqglRCKPmC2jsVcKhTJhP3KWfcFSlwJJaVBi8uea/8ZGZK9IT6X0gAQWP9qKoLppXHYzwk7KB/0bF2gCa4BhViWSFGsYJ6+tSLvA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=MM4TjlEWaXShfk+NDTfK8iWqM+20KIjfFl0FpudPOHE=; b=RvRqFl/ZWPvh35zZjz5PrpOwj+WseBWFpN6fvyT27XIYBoDaY/aQrdah719RzRiNG1g+ln/CwiaTnD1Mvrc6laBgdgMWwAzCwLyXPy0CTEYEerRQ4FOWCAsFDvk+3jv+HGT/TBFcSwp9sxEsj/RTUmIzQaCfRfcvB47TYDEh9yQ= Received: from FR3P281CA0131.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:94::14) by DB9PR08MB7843.eurprd08.prod.outlook.com (2603:10a6:10:39e::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Wed, 11 Jan 2023 14:18:24 +0000 Received: from VI1EUR03FT017.eop-EUR03.prod.protection.outlook.com (2603:10a6:d10:94:cafe::a2) by FR3P281CA0131.outlook.office365.com (2603:10a6:d10:94::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6002.12 via Frontend Transport; Wed, 11 Jan 2023 14:18:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; pr=C Received: from nebula.arm.com (40.67.248.234) by VI1EUR03FT017.mail.protection.outlook.com (100.127.145.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6002.13 via Frontend Transport; Wed, 11 Jan 2023 14:18:23 +0000 Received: from AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 11 Jan 2023 14:18:23 +0000 Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX02.Emea.Arm.com (10.251.26.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 11 Jan 2023 14:18:22 +0000 Received: from e129018.arm.com (10.57.77.59) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Wed, 11 Jan 2023 14:18:22 +0000 From: Christophe Lyon To: CC: , Christophe Lyon Subject: [PATCH v3 2/2] aarch64: Fix bit-field alignment in param passing [PR105549] Date: Wed, 11 Jan 2023 15:18:06 +0100 Message-ID: <20230111141806.258233-2-christophe.lyon@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230111141806.258233-1-christophe.lyon@arm.com> References: <20230111141806.258233-1-christophe.lyon@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: VI1EUR03FT017:EE_|DB9PR08MB7843:EE_|AM7EUR03FT023:EE_|AM7PR08MB5350:EE_ X-MS-Office365-Filtering-Correlation-Id: df3a71f0-4f4e-42f0-0c0b-08daf3debacd x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: +GcGmZRYXNy5/p/NrUqAKbf9lfFFw3HVpaOA2h29E08nzHR+3URnzfXq84qpQ1cyHXwIaJSKyf7GSw9yx/x4pKXSwrxftvymC/9D3Ij5Fi/AkeBJo1j1eSwmwBksXGtELpHHZvmDqstFe9qp/e5gp8nuYns6B4qohbRQndvO03bg/uUqJku32j+aWCDgP42i6cx9UETSqfWdUuqO417FFcaOmbYm/sgikvkdmlYzP/oB28wAF9PiLF2Mw9Hpl+9xKDmi0TsljaOF/HTVM2ocJxadw9xysH49FqetUB49z0v/oMkz3j+I6Tv1pabg0K//gkIxa8FeAA9To5Zc5nhmHKpCE51kCZDMsMlYCif1E/kcMFUMT+FOCUNJ5x2VZ+OoIFae+080dzhmTaUs/twaR5Zwhh61wDffhELovSfbjoRFjqPLnGOhPndrN/44fqqIOE0GSA5n4QtwgLRuQm8H56GM6nIVxb2+nr9fL5XAPYf3JA/MFP4Op4HH1G+FZhoJbncgQWKPtOU6m4lAdoGZFCscyghEPFV+qcsaULB5QyfDaxeUcTqCXsvgCg4EJglsJXF/FVcIPZZuZx6APJyi3gK/88kLtlQ3bcQIxUWnpeNnsXb899gef7t0flXQE5gmMYPCChy6CLg23TGussqMRfD59s69i3UZOySJTXfehscwi8xJitcjow2x/Bj35hiIimRW1Razjb7ExSxxmLnGH6ZY339JUt6OXvLzZVyCLpMDvAHGvDPghrPTHzMDSQAT3EcKfFuoIj+ezDEhJbpNBg== X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230022)(4636009)(376002)(39860400002)(136003)(346002)(396003)(451199015)(36840700001)(46966006)(84970400001)(86362001)(4001150100001)(44832011)(2906002)(426003)(5660300002)(30864003)(6666004)(36756003)(8936002)(41300700001)(70206006)(70586007)(8676002)(4326008)(83380400001)(82310400005)(82740400003)(356005)(316002)(47076005)(36860700001)(2616005)(336012)(1076003)(54906003)(19627235002)(6916009)(40480700001)(186003)(26005)(7696005)(478600001)(81166007)(36900700001)(559001)(579004);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB7843 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM7EUR03FT023.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 6ec2f643-6448-40fc-5d0c-08daf3deb2fc X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CBQWHdpUnAzieuEvvpVK4tBc4gtgJ/skSQYdLiXBleNLmEr6dyReVWCUIrBIwaJmHpVkAP/tSIvGVSexoYyjrRux3/oqWGL+0cUPEI5TPsRGJH4K54QO3hO83qxh55yIsKTw6LUgCe196zAN9GoVvz6h/o/cXnB5DlEaeQkbH5YLAcZH388a7amDe9nFI6uVj1X0S26MwI2g1A4ED81V+4Ko4Tk7glat74FHLri9TfOKboc8vXpMzXPTv+d9xZrVirGn7+vVK1xfpHW8hWkY36BHLd/1vbwlfK1EnNSbMvMeRI+I940fphGOrLlIUJ2hY885ClOfPrpPqiCnQ2sgXVWFgUqgp1KFnGgoPnjEHIRtsqXXC4bauhwit//6yB5bwOqiL7SDC4T+bKEFv2I5zz3ErRep3Wb6b3lU8+gRjk3lyojifzM7808oT2oUUo5xGY2p1caDevF9XAfcbi1WpFBgzn+zx1WhZmFkC/cJLPgYttqtWz4xOpuykngdNwSqs9k7BEx3gm+KzCNt9fyza2a7UMTflO14pgC/fgG3XSlME8W1aJSa3fspzQ3qzhBUOEZzX2C6mBPgCyUpwEb/TmHv9uXVjYsKQ8QGHoJ92FJ1XNr7sGxBJILFod+UWr4KbH3eAfX7MOu4C1tUnFy51Oe9/rejQucN+1hqbxCSYEPneKWLcry5ekJoJk4JcZ53dk1zMrPX0h6Gtc/xGAkfjaKzc9gpxoQ6bDkHwWgk6B+eOnI7jQg9o86RA81aTUc5+AAVNGXQZhOilo5IPVZ4bQ== X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(13230022)(4636009)(376002)(39860400002)(136003)(346002)(396003)(451199015)(40470700004)(46966006)(36840700001)(84970400001)(44832011)(4001150100001)(2906002)(30864003)(5660300002)(36860700001)(41300700001)(7696005)(36756003)(8936002)(8676002)(70206006)(70586007)(83380400001)(4326008)(2616005)(47076005)(19627235002)(86362001)(316002)(426003)(82310400005)(336012)(1076003)(40460700003)(478600001)(40480700001)(6666004)(81166007)(186003)(26005)(54906003)(6916009)(82740400003)(559001)(579004);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2023 14:18:36.7854 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df3a71f0-4f4e-42f0-0c0b-08daf3debacd X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM7EUR03FT023.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM7PR08MB5350 X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,FORGED_SPF_HELO,GIT_PATCH_0,KAM_DMARC_NONE,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE,TXREP,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: While working on enabling DFP for AArch64, I noticed new failures in gcc.dg/compat/struct-layout-1.exp (t028) which were not actually caused by DFP types handling. These tests are generated during 'make check' and enabling DFP made generation different (not sure if new non-DFP tests are generated, or if existing ones are generated differently, the tests in question are huge and difficult to compare). Anyway, I reduced the problem to what I attach at the end of the new gcc.target/aarch64/aapcs64/va_arg-17.c test and rewrote it in the same scheme as other va_arg* AArch64 tests. Richard Sandiford further reduced this to a non-vararg function, added as a second testcase. This is a tough case mixing bit-fields and alignment, where aarch64_function_arg_alignment did not follow what its descriptive comment says: we want to use the natural alignment of the bit-field type only if the user didn't reduce the alignment for the bit-field itself. The patch also adds a comment and assert that would help someone who has to look at this area again. The fix would be very small, except that this introduces a new ABI break, and we have to warn about that. Since this actually fixes a problem introduced in GCC 9.1, we keep the old computation to detect when we now behave differently. This patch adds two new tests (va_arg-17.c and pr105549.c). va_arg-17.c contains the reduced offending testcase from struct-layout-1.exp for reference. We update some tests introduced by the previous patch, where parameters with bit-fields and packed attribute now emit a different warning. v2->v3: testcase update 2022-11-28 Christophe Lyon Richard Sandiford gcc/ PR target/105549 * config/aarch64/aarch64.cc (aarch64_function_arg_alignment): Check DECL_PACKED for bitfield. (aarch64_layout_arg): Warn when parameter passing ABI changes. (aarch64_function_arg_boundary): Do not warn here. (aarch64_gimplify_va_arg_expr): Warn when parameter passing ABI changes. gcc/testsuite/ PR target/105549 * gcc.target/aarch64/bitfield-abi-warning-align16-O2.c: Update. * gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c: Update. * gcc.target/aarch64/bitfield-abi-warning-align32-O2.c: Update. * gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c: Update. * gcc.target/aarch64/aapcs64/va_arg-17.c: New test. * gcc.target/aarch64/pr105549.c: New test. * g++.target/aarch64/bitfield-abi-warning-align16-O2.C: Update. * g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C: Update. * g++.target/aarch64/bitfield-abi-warning-align32-O2.C: Update. * g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C: Update. --- gcc/config/aarch64/aarch64.cc | 148 ++++++++++++++---- .../bitfield-abi-warning-align16-O2-extra.C | 64 ++++---- .../aarch64/bitfield-abi-warning-align16-O2.C | 48 +++--- .../bitfield-abi-warning-align32-O2-extra.C | 131 +++++++--------- .../aarch64/bitfield-abi-warning-align32-O2.C | 132 ++++++++-------- .../gcc.target/aarch64/aapcs64/va_arg-17.c | 105 +++++++++++++ .../bitfield-abi-warning-align16-O2-extra.c | 64 ++++---- .../aarch64/bitfield-abi-warning-align16-O2.c | 48 +++--- .../bitfield-abi-warning-align32-O2-extra.c | 131 +++++++--------- .../aarch64/bitfield-abi-warning-align32-O2.c | 132 ++++++++-------- gcc/testsuite/gcc.target/aarch64/pr105549.c | 12 ++ 11 files changed, 587 insertions(+), 428 deletions(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-17.c create mode 100644 gcc/testsuite/gcc.target/aarch64/pr105549.c diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index 3623df5bd94..a6d95dd85bf 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -7265,14 +7265,18 @@ aarch64_vfp_is_call_candidate (cumulative_args_t pcum_v, machine_mode mode, bits. The idea is to suppress any stronger alignment requested by the user and opt for the natural alignment (specified in AAPCS64 \S 4.1). ABI_BREAK is set to the old alignment if the alignment was - incorrectly calculated in versions of GCC prior to GCC-9. This is - a helper function for local use only. */ + incorrectly calculated in versions of GCC prior to GCC-9. + ABI_BREAK_PACKED is set to the old alignment if it was incorrectly + calculated in versions between GCC-9 and GCC-13. This is a helper + function for local use only. */ static unsigned int aarch64_function_arg_alignment (machine_mode mode, const_tree type, - unsigned int *abi_break) + unsigned int *abi_break, + unsigned int *abi_break_packed) { *abi_break = 0; + *abi_break_packed = 0; if (!type) return GET_MODE_ALIGNMENT (mode); @@ -7288,6 +7292,7 @@ aarch64_function_arg_alignment (machine_mode mode, const_tree type, return TYPE_ALIGN (TREE_TYPE (type)); unsigned int alignment = 0; + unsigned int bitfield_alignment_with_packed = 0; unsigned int bitfield_alignment = 0; for (tree field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) if (TREE_CODE (field) == FIELD_DECL) @@ -7307,11 +7312,30 @@ aarch64_function_arg_alignment (machine_mode mode, const_tree type, but gains 8-byte alignment and size thanks to "e". */ alignment = std::max (alignment, DECL_ALIGN (field)); if (DECL_BIT_FIELD_TYPE (field)) - bitfield_alignment - = std::max (bitfield_alignment, - TYPE_ALIGN (DECL_BIT_FIELD_TYPE (field))); + { + /* Take the bit-field type's alignment into account only + if the user didn't reduce this field's alignment with + the packed attribute. */ + if (!DECL_PACKED (field)) + bitfield_alignment + = std::max (bitfield_alignment, + TYPE_ALIGN (DECL_BIT_FIELD_TYPE (field))); + + /* Compute the alignment even if the bit-field is + packed, so that we can emit a warning in case the + alignment changed between GCC versions. */ + bitfield_alignment_with_packed + = std::max (bitfield_alignment_with_packed, + TYPE_ALIGN (DECL_BIT_FIELD_TYPE (field))); + } } + /* Emit a warning if the alignment is different when taking the + 'packed' attribute into account. */ + if (bitfield_alignment != bitfield_alignment_with_packed + && bitfield_alignment_with_packed > alignment) + *abi_break_packed = bitfield_alignment_with_packed; + if (bitfield_alignment > alignment) { *abi_break = alignment; @@ -7337,6 +7361,7 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) bool allocate_ncrn, allocate_nvrn; HOST_WIDE_INT size; unsigned int abi_break; + unsigned int abi_break_packed; /* We need to do this once per argument. */ if (pcum->aapcs_arg_processed) @@ -7348,9 +7373,57 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) && (currently_expanding_function_start || currently_expanding_gimple_stmt)); + /* There are several things to note here: + + - Both the C and AAPCS64 interpretations of a type's alignment should + give a value that is no greater than the type's size. + + - Types bigger than 16 bytes are passed indirectly. + + - If an argument of type T is passed indirectly, TYPE and MODE describe + a pointer to T rather than T iself. + + It follows that the AAPCS64 alignment of TYPE must be no greater + than 16 bytes. + + Versions prior to GCC 9.1 ignored a bitfield's underlying type + and so could calculate an alignment that was too small. If this + happened for TYPE then ABI_BREAK is this older, too-small alignment. + + Although GCC 9.1 fixed that bug, it introduced a different one: + it would consider the alignment of a bitfield's underlying type even + if the field was packed (which should have the effect of overriding + the alignment of the underlying type). This was fixed in GCC 13.1. + + As a result of this bug, GCC 9 to GCC 12 could calculate an alignment + that was too big. If this happened for TYPE, ABI_BREAK_PACKED is + this older, too-big alignment. + + Also, the fact that GCC 9 to GCC 12 considered irrelevant + alignments meant they could calculate type alignments that were + bigger than the type's size, contrary to the assumption above. + The handling of register arguments was nevertheless (and justifiably) + written to follow the assumption that the alignment can never be + greater than the size. The same was not true for stack arguments; + their alignment was instead handled by MIN bounds in + aarch64_function_arg_boundary. + + The net effect is that, if GCC 9 to GCC 12 incorrectly calculated + an alignment of more than 16 bytes for TYPE then: + + - If the argument was passed in registers, these GCC versions + would treat the alignment as though it was *less than* 16 bytes. + + - If the argument was passed on the stack, these GCC versions + would treat the alignment as though it was *equal to* 16 bytes. + + Both behaviors were wrong, but in different cases. */ unsigned int alignment - = aarch64_function_arg_alignment (mode, type, &abi_break); - gcc_assert (!alignment || abi_break < alignment); + = aarch64_function_arg_alignment (mode, type, &abi_break, + &abi_break_packed); + gcc_assert (alignment <= 16 * BITS_PER_UNIT + && (!alignment || abi_break < alignment) + && (!abi_break_packed || alignment < abi_break_packed)); pcum->aapcs_arg_processed = true; @@ -7488,19 +7561,29 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) /* C.8 if the argument has an alignment of 16 then the NGRN is rounded up to the next even number. */ if (nregs == 2 - && ncrn % 2 + && ncrn % 2) + { + /* Emit a warning if the alignment changed when taking the + 'packed' attribute into account. */ + if (warn_pcs_change + && abi_break_packed + && ((abi_break_packed == 16 * BITS_PER_UNIT) + != (alignment == 16 * BITS_PER_UNIT))) + inform (input_location, "parameter passing for argument of type " + "%qT changed in GCC 13.1", type); + /* The == 16 * BITS_PER_UNIT instead of >= 16 * BITS_PER_UNIT comparison is there because for > 16 * BITS_PER_UNIT alignment nregs should be > 2 and therefore it should be passed by reference rather than value. */ - && (aarch64_function_arg_alignment (mode, type, &abi_break) - == 16 * BITS_PER_UNIT)) - { - if (warn_pcs_change && abi_break) - inform (input_location, "parameter passing for argument of type " - "%qT changed in GCC 9.1", type); - ++ncrn; - gcc_assert (ncrn + nregs <= NUM_ARG_REGS); + if (alignment == 16 * BITS_PER_UNIT) + { + if (warn_pcs_change && abi_break) + inform (input_location, "parameter passing for argument of type " + "%qT changed in GCC 9.1", type); + ++ncrn; + gcc_assert (ncrn + nregs <= NUM_ARG_REGS); + } } /* If an argument with an SVE mode needs to be shifted up to the @@ -7553,8 +7636,14 @@ aarch64_layout_arg (cumulative_args_t pcum_v, const function_arg_info &arg) on_stack: pcum->aapcs_stack_words = size / UNITS_PER_WORD; - if (aarch64_function_arg_alignment (mode, type, &abi_break) - == 16 * BITS_PER_UNIT) + if (warn_pcs_change + && abi_break_packed + && ((abi_break_packed >= 16 * BITS_PER_UNIT) + != (alignment >= 16 * BITS_PER_UNIT))) + inform (input_location, "parameter passing for argument of type " + "%qT changed in GCC 13.1", type); + + if (alignment == 16 * BITS_PER_UNIT) { int new_size = ROUND_UP (pcum->aapcs_stack_size, 16 / UNITS_PER_WORD); if (pcum->aapcs_stack_size != new_size) @@ -7676,16 +7765,13 @@ static unsigned int aarch64_function_arg_boundary (machine_mode mode, const_tree type) { unsigned int abi_break; + unsigned int abi_break_packed; unsigned int alignment = aarch64_function_arg_alignment (mode, type, - &abi_break); + &abi_break, + &abi_break_packed); + /* We rely on aarch64_layout_arg and aarch64_gimplify_va_arg_expr + to emit warnings about ABI incompatibility. */ alignment = MIN (MAX (alignment, PARM_BOUNDARY), STACK_BOUNDARY); - if (abi_break && warn_psabi) - { - abi_break = MIN (MAX (abi_break, PARM_BOUNDARY), STACK_BOUNDARY); - if (alignment != abi_break) - inform (input_location, "parameter passing for argument of type " - "%qT changed in GCC 9.1", type); - } return alignment; } @@ -19544,8 +19630,10 @@ aarch64_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, size = int_size_in_bytes (type); unsigned int abi_break; + unsigned int abi_break_packed; align - = aarch64_function_arg_alignment (mode, type, &abi_break) / BITS_PER_UNIT; + = aarch64_function_arg_alignment (mode, type, &abi_break, &abi_break_packed) + / BITS_PER_UNIT; dw_align = false; adjust = 0; @@ -19588,6 +19676,10 @@ aarch64_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p, rsize = ROUND_UP (size, UNITS_PER_WORD); nregs = rsize / UNITS_PER_WORD; + if (align <= 8 && abi_break_packed && warn_psabi) + inform (input_location, "parameter passing for argument of type " + "%qT changed in GCC 13.1", type); + if (align > 8) { if (abi_break && warn_psabi) diff --git a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C index c45be832d5b..443cd458b4c 100644 --- a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C +++ b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2-extra.C @@ -7,9 +7,9 @@ #include "bitfield-abi-warning.h" /* In f1, f2, f4, f8, f16, f16p (and stdarg versions): */ -/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 12 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 12 } } */ /* In fp, f1p, f2p, f4p, f8p (and stdarg versions): */ -/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 } } */ /* Bitfield parameter in registers. */ /* { dg-note {parameter passing for argument of type 'S1' changed in GCC 9.1} "" { target *-*-* } 47 } f1 */ @@ -17,11 +17,11 @@ /* { dg-note {parameter passing for argument of type 'S4' changed in GCC 9.1} "" { target *-*-* } 49 } f4 */ /* { dg-note {parameter passing for argument of type 'S8' changed in GCC 9.1} "" { target *-*-* } 50 } f8 */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 53 } fp */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 54 } f1p */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 55 } f2p */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 56 } f4p */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 57 } f8p */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 53 } fp */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 54 } f1p */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 55 } f2p */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 56 } f4p */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 57 } f8p */ /* Bitfield call argument in registers. */ /* { dg-note {parameter passing for argument of type 'S1' changed in GCC 9.1} "" { target *-*-* } 60 } g1 */ @@ -29,11 +29,11 @@ /* { dg-note {parameter passing for argument of type 'S4' changed in GCC 9.1} "" { target *-*-* } 62 } g4 */ /* { dg-note {parameter passing for argument of type 'S8' changed in GCC 9.1} "" { target *-*-* } 63 } g8 */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 66 } gp */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 67 } g1p */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 68 } g2p */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 69 } g4p */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 70 } g8p */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 66 } gp */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 67 } g1p */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 68 } g2p */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 69 } g4p */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 70 } g8p */ /* Bitfield parameter in stack. */ @@ -42,11 +42,11 @@ /* { dg-note {parameter passing for argument of type 'S4' changed in GCC 9.1} "" { target *-*-* } 76 } f4_stack */ /* { dg-note {parameter passing for argument of type 'S8' changed in GCC 9.1} "" { target *-*-* } 77 } f8_stack */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 80 } fp_stack */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 81 } f1p_stack */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 82 } f2p_stack */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 83 } f4p_stack */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 84 } f8p_stack */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 80 } fp_stack */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 81 } f1p_stack */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 82 } f2p_stack */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 83 } f4p_stack */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 84 } f8p_stack */ /* Bitfield call argument in stack. */ /* { dg-note {parameter passing for argument of type 'S1' changed in GCC 9.1} "" { target *-*-* } 87 } g1_stack */ @@ -54,11 +54,11 @@ /* { dg-note {parameter passing for argument of type 'S4' changed in GCC 9.1} "" { target *-*-* } 89 } g4_stack */ /* { dg-note {parameter passing for argument of type 'S8' changed in GCC 9.1} "" { target *-*-* } 90 } g8_stack */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 93 } gp_stack */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 94 } g1p_stack */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 95 } g2p_stack */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 96 } g4p_stack */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 97 } g8p_stack */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 93 } gp_stack */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 94 } g1p_stack */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 95 } g2p_stack */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 96 } g4p_stack */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 97 } g8p_stack */ /* Bitfield parameter in stdarg. */ @@ -67,11 +67,11 @@ /* { dg-note {parameter passing for argument of type 'S4' changed in GCC 9.1} "" { target *-*-* } 103 } f4_stdarg */ /* { dg-note {parameter passing for argument of type 'S8' changed in GCC 9.1} "" { target *-*-* } 104 } f8_stdarg */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 107 } fp_stdarg */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 108 } f1p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 109 } f2p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 110 } f4p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 111 } f8p_stdarg */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 107 } fp_stdarg */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 108 } f1p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 109 } f2p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 110 } f4p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 111 } f8p_stdarg */ /* Bitfield call argument in stdarg. */ /* { dg-note {parameter passing for argument of type 'S1' changed in GCC 9.1} "" { target *-*-* } 114 } g1_stdarg */ @@ -79,8 +79,8 @@ /* { dg-note {parameter passing for argument of type 'S4' changed in GCC 9.1} "" { target *-*-* } 116 } g4_stdarg */ /* { dg-note {parameter passing for argument of type 'S8' changed in GCC 9.1} "" { target *-*-* } 117 } g8_stdarg */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 120 } gp_stdarg */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 121 } g1p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 122 } g2p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 123 } g4p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 124 } g8p_stdarg */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 120 } gp_stdarg */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 121 } g1p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 122 } g2p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 123 } g4p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 124 } g8p_stdarg */ diff --git a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C index 61d12ec22eb..1359cc6eb49 100644 --- a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C +++ b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align16-O2.C @@ -7,9 +7,9 @@ #include "bitfield-abi-warning.h" /* In f1, f2, f4, f8, f16, f16p (and stdarg versions): */ -/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 12 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 12 } } */ /* In fp, f1p, f2p, f4p, f8p (and stdarg versions): */ -/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 } } */ /* Bitfield parameter in registers. */ /* { dg-note {parameter passing for argument of type 'S1' changed in GCC 9.1} "" { target *-*-* } 47 } f1 */ @@ -17,15 +17,9 @@ /* { dg-note {parameter passing for argument of type 'S4' changed in GCC 9.1} "" { target *-*-* } 49 } f4 */ /* { dg-note {parameter passing for argument of type 'S8' changed in GCC 9.1} "" { target *-*-* } 50 } f8 */ -/* No change in parameter passing in GCC 9.1 for lines 53-57 (fp, f1p, f2p, - f4p, f8p) (because the argument fits in a single register). Should not - warn, but aarch64_function_arg_boundary would need to take the argument size - into account as well as whether it's passed via registers or the stack. */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 53 } fp */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 54 } f1p */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 55 } f2p */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 56 } f4p */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 57 } f8p */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 53-57 (fp, + f1p, f2p, f4p, f8p) because the argument fits in a single register. + No warning expected. */ /* Bitfield call argument in registers. */ /* { dg-note {parameter passing for argument of type 'S1' changed in GCC 9.1} "" { target *-*-* } 60 } g1 */ @@ -43,11 +37,11 @@ /* { dg-note {parameter passing for argument of type 'S4' changed in GCC 9.1} "" { target *-*-* } 76 } f4_stack */ /* { dg-note {parameter passing for argument of type 'S8' changed in GCC 9.1} "" { target *-*-* } 77 } f8_stack */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 80 } fp_stack */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 81 } f1p_stack */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 82 } f2p_stack */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 83 } f4p_stack */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 84 } f8p_stack */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 80 } fp_stack */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 81 } f1p_stack */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 82 } f2p_stack */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 83 } f4p_stack */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 84 } f8p_stack */ /* Bitfield call argument in stack. */ /* { dg-note {parameter passing for argument of type 'S1' changed in GCC 9.1} "" { target *-*-* } 87 } g1_stack */ @@ -55,11 +49,11 @@ /* { dg-note {parameter passing for argument of type 'S4' changed in GCC 9.1} "" { target *-*-* } 89 } g4_stack */ /* { dg-note {parameter passing for argument of type 'S8' changed in GCC 9.1} "" { target *-*-* } 90 } g8_stack */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 93 } gp_stack */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 94 } g1p_stack */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 95 } g2p_stack */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 96 } g4p_stack */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 97 } g8p_stack */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 93 } gp_stack */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 94 } g1p_stack */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 95 } g2p_stack */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 96 } g4p_stack */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 97 } g8p_stack */ /* Bitfield parameter in stdarg. */ @@ -68,14 +62,14 @@ /* { dg-note {parameter passing for argument of type 'S4' changed in GCC 9.1} "" { target *-*-* } 103 } f4_stdarg */ /* { dg-note {parameter passing for argument of type 'S8' changed in GCC 9.1} "" { target *-*-* } 104 } f8_stdarg */ -/* Parameter passing for these should not have changed in GCC 9.1 (PR 105549). +/* FIXME Parameter passing for these should not have changed in GCC 9.1 (PR 105549). Fortunately we warn. Note the discrepancy with lines 120-124 below: we warn in the callee, but not in the caller. */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 107 } fp_stdarg */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 108 } f1p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 109 } f2p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 110 } f4p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 111 } f8p_stdarg */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 107 } fp_stdarg */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 108 } f1p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 109 } f2p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 110 } f4p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 111 } f8p_stdarg */ /* Bitfield call argument in stdarg. */ /* { dg-note {parameter passing for argument of type 'S1' changed in GCC 9.1} "" { target *-*-* } 114 } g1_stdarg */ diff --git a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C index 04b183af697..6f8f54f41ff 100644 --- a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C +++ b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2-extra.C @@ -11,109 +11,96 @@ /* { dg-final { scan-assembler-times "ldr\tx0, \\\[x1\\\]" 10 } } */ /* In fp, f1p, f2p, f4p, f8p (and stdarg versions): */ -/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 } } */ /* In f16p (and stdarg version): */ -/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 2 } } */ -/* In f1_stack, f2_stack, f4_stack, f8_stack, f16_stack, f8p_stack: */ -/* { dg-final { scan-assembler-times "ldr\tx\[0-9\]+, \\\[sp, 8\\\]" 6 { xfail *-*-* } } } */ - -/* In fp_stack, f1p_stack: */ -/* { dg-final { scan-assembler-times "ldrb\tw0, \\\[sp, 8\\\]" 2 { xfail *-*-* } } } */ - -/* In f2p_stack: */ -/* { dg-final { scan-assembler-times "ldrh\tw0, \\\[sp, 8\\\]" 1 { xfail *-*-* } } } */ - -/* In f4p_stack: */ -/* { dg-final { scan-assembler-times "ldr\tw0, \\\[sp, 8\\\]" 1 { xfail *-*-* } } } */ +/* In f1_stack, f2_stack, f4_stack, f8_stack, f16_stack, fp_stack, + f1p_stack, f2p_stack, f4p_stack, f8p_stack: */ +/* { dg-final { scan-assembler-times "ldr\tx\[0-9\]+, \\\[sp, 8\\\]" 10 } } */ /* In f16p_stack: */ -/* { dg-final { scan-assembler-times "ldr\tx0, \\\[sp, 16\\\]" 1 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "ldr\tx\[0-9\]+, \\\[sp, 16\\\]" 1 } } */ /* Bitfield parameter in registers. */ -/* No change in parameter passing in GCC 9.1 for lines 47-51 (f1, f2, f4, f8, f16) - because the overall alignment is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 47-51 (f1, + f2, f4, f8, f16) because the overall alignment is > 16. No warning + expected. */ -/* No change in parameter passing in GCC 9.1 for lines 53-57 (fp, f1p, f2p, - f4p, f8p) because the argument fits in a single register. Should not warn, - but aarch64_function_arg_boundary would need to take the argument size into - account as well as whether it's passed via registers or the stack. */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 53 } fp */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 54 } f1p */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 55 } f2p */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 56 } f4p */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 57 } f8p */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 53-57 (fp, + f1p, f2p, f4p, f8p) because the alignment that GCC 9.1 calculated for the + underlying type was 32 bytes (above the maximum expected of 16). */ -/* Changed in GCC 9.1, but we fail to emit a warning since GCC 11 (was OK with GCC 9). */ -/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 9.1} "" { xfail *-*-* } 58 } f16p */ +/* Changed again in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 13.1} "" { target *-*-* } 58 } f16p */ /* Bitfield call argument in registers. */ -/* No change in parameter passing in GCC 9.1 for lines 60-64 (g1, g2, g4, g8, g16) - because the overall alignment is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 60-64 (g1, + g2, g4, g8, g16) because the overall alignment is > 16. No warning + expected. */ -/* No change in parameter passing in GCC 9.1 for lines 66-70 (gp, g1p, g2p, - g4p, g8p), no warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 66-70 (gp, + g1p, g2p, g4p, g8p), no warning expected. */ -/* Changed in GCC 9.1, but we fail to emit a warning. */ -/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 9.1} "" { xfail *-*-* } 71 } g16p */ +/* Changed again in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 13.1} "" { target *-*-* } 71 } g16p */ /* Bitfield parameter in stack. */ -/* No change in parameter passing in GCC 9.1 for lines 74-78 (f1_stack, - f2_stack, f4_stack, f8_stack, f16_stack) because the overall alignment is > - 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 74-78 + (f1_stack, f2_stack, f4_stack, f8_stack, f16_stack) because the overall + alignment is > 16. No warning expected. */ -/* Changed in GCC 9.1. */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 80 } fp_stack */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 81 } f1p_stack */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 82 } f2p_stack */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 83 } f4p_stack */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 84 } f8p_stack */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 80 } fp_stack */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 81 } f1p_stack */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 82 } f2p_stack */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 83 } f4p_stack */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 84 } f8p_stack */ -/* No change in parameter passing in GCC 9.1 for line 85 (f16p_stack) because - the overall alignment is >= 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for line 85 + (f16p_stack). No warning expected. */ /* Bitfield call argument in stack. */ -/* No change in parameter passing in GCC 9.1 for lines 87-91 (g1_stack, - g2_stack, g4_stack, g8_stack, g16_stack) because the overall alignment is > - 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC13.1 for lines 87-91 + (g1_stack, g2_stack, g4_stack, g8_stack, g16_stack) because the overall + alignment is > 16. No warning expected. */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 93 } gp_stack */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 94 } g1p_stack */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 95 } g2p_stack */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 96 } g4p_stack */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 97 } g8p_stack */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 93 } gp_stack */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 94 } g1p_stack */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 95 } g2p_stack */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 96 } g4p_stack */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 97 } g8p_stack */ -/* No change in parameter passing in GCC 9.1 for line 98 (g16p_stack). No - warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for line 98 + (g16p_stack). No warning expected. */ /* Bitfield parameter in stdarg. */ -/* No change in parameter passing in GCC 9.1 for lines 101-105 (f1_stdarg, - f2_stdarg, f4_stdarg, f8_stdarg, f16_stdarg) because the overall alignment - is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 101-105 + (f1_stdarg, f2_stdarg, f4_stdarg, f8_stdarg, f16_stdarg) because the overall + alignment is > 16. No warning expected. */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 107 } fp_stdarg */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 108 } f1p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 109 } f2p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 110 } f4p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 111 } f8p_stdarg */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 107 } fp_stdarg */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 108 } f1p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 109 } f2p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 110 } f4p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 111 } f8p_stdarg */ -/* No change in parameter passing in GCC 9.1 for line 112 (f16p_stdarg). - Should not warn. */ -/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 9.1} "" { target *-*-* } 112 } f16p_stdarg */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for line 112 (f16p_stdarg). + No warning expected. */ /* Bitfield call argument in stdarg. */ -/* No change in parameter passing in GCC 9.1 for lines 114-118 (g1_stdarg, - g2_stdarg, g4_stdarg, g8_stdarg, g16_stdarg) because the overall alignment - is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 114-118 + (g1_stdarg, g2_stdarg, g4_stdarg, g8_stdarg, g16_stdarg) because the overall + alignment is > 16. No warning expected. */ -/* No change in parameter passing in GCC 9.1 for lines 120-124 (gp_stdarg, - g1p_stdarg, g2p_stdarg, g4p_stdarg, g8p_stdarg), no warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 120-124 + (gp_stdarg, g1p_stdarg, g2p_stdarg, g4p_stdarg, g8p_stdarg), no warning + expected. */ -/* Changed in GCC 9.1, but we fail to emit a warning. */ -/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 9.1} "" { xfail *-*-* } 125 } g16p_stdarg */ +/* Changed again in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 13.1} "" { target *-*-* } 125 } g16p_stdarg */ diff --git a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C index cdb5b4df774..6b8ad5fbea1 100644 --- a/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C +++ b/gcc/testsuite/g++.target/aarch64/bitfield-abi-warning-align32-O2.C @@ -10,110 +10,104 @@ /* { dg-final { scan-assembler-times "ldr\tx0, \\\[x1\\\]" 10 } } */ /* In fp, f1p, f2p, f4p, f8p (and stdarg versions): */ -/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 } } */ /* In f16p (and stdarg version): */ -/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 2 } } */ /* In f1_stack, f2_stack, f4_stack, f8_stack, f16_stack, f8p_stack: */ -/* { dg-final { scan-assembler-times "ldr\tx\[0-9\]+, \\\[sp, 8\\\]" 6 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "ldr\tx\[0-9\]+, \\\[sp, 8\\\]" 6 } } */ /* In fp_stack, f1p_stack: */ -/* { dg-final { scan-assembler-times "ldrb\tw0, \\\[sp, 8\\\]" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "ldrb\tw0, \\\[sp, 8\\\]" 2 } } */ /* In f2p_stack: */ -/* { dg-final { scan-assembler-times "ldrh\tw0, \\\[sp, 8\\\]" 1 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "ldrh\tw0, \\\[sp, 8\\\]" 1 } } */ /* In f4p_stack: */ -/* { dg-final { scan-assembler-times "ldr\tw0, \\\[sp, 8\\\]" 1 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "ldr\tw0, \\\[sp, 8\\\]" 1 } } */ /* In f16p_stack: */ -/* { dg-final { scan-assembler-times "ldr\tx0, \\\[sp, 16\\\]" 1 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "ldr\tx0, \\\[sp, 16\\\]" 1 } } */ /* Bitfield parameter in registers. */ -/* No change in parameter passing in GCC 9.1 for lines 47-51 (f1, f2, f4, f8, f16) - because the overall alignment is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 47-51 (f1, + f2, f4, f8, f16) because the overall alignment is > 16. No warning + expected. */ -/* No change in parameter passing in GCC 9.1 for lines 53-57 (fp, f1p, f2p, - f4p, f8p) because the argument fits in a single register. Should not warn, - but aarch64_function_arg_boundary would need to take the argument size into - account as well as whether it's passed via registers or the stack. */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 53 } fp */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 54 } f1p */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 55 } f2p */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 56 } f4p */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 57 } f8p */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 53-57 (fp, + f1p, f2p, f4p, f8p) because the argument fits in a single register. + No warning expected. */ -/* Changed in GCC 9.1, but we fail to emit a warning since GCC 11 (was OK with GCC 9). */ -/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 9.1} "" { xfail *-*-* } 58 } f16p */ +/* Changes in GCC 13.1, we restore the same codegen as before GCC 9.1 . */ +/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 13.1} "" { target *-*-* } 58 } f16p */ /* Bitfield call argument in registers. */ -/* No change in parameter passing in GCC 9.1 for lines 60-64 (g1, g2, g4, g8, g16) - because the overall alignment is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 60-64 (g1, + g2, g4, g8, g16) because the overall alignment is > 16. No warning + expected. */ -/* No change in parameter passing in GCC 9.1 for lines 66-70 (gp, g1p, g2p, - g4p, g8p), no warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 66-70 (gp, + g1p, g2p, g4p, g8p), no warning expected. */ -/* Changed in GCC 9.1, but we fail to emit a warning. */ -/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 9.1} "" { xfail *-*-* } 71 } g16p */ +/* Changed in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 13.1} "" { target *-*-* } 71 } g16p */ /* Bitfield parameter in stack. */ -/* No change in parameter passing in GCC 9.1 for lines 74-78 (f1_stack, - f2_stack, f4_stack, f8_stack, f16_stack) because the overall alignment is > - 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 74-78 + (f1_stack, f2_stack, f4_stack, f8_stack, f16_stack) because the overall + alignment is > 16. No warning expected. */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 80 } fp_stack */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 81 } f1p_stack */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 82 } f2p_stack */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 83 } f4p_stack */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 84 } f8p_stack */ +/* Changed in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 80 } fp_stack */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 81 } f1p_stack */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 82 } f2p_stack */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 83 } f4p_stack */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 84 } f8p_stack */ -/* No change in parameter passing in GCC 9.1 for line 85 (f16p_stack) because - the overall alignment is >= 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for line 85 + (f16p_stack). No warning expected. */ /* Bitfield call argument in stack. */ -/* No change in parameter passing in GCC 9.1 for lines 87-91 (g1_stack, - g2_stack, g4_stack, g8_stack, g16_stack) because the overall alignment is > - 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 87-91 + (g1_stack, g2_stack, g4_stack, g8_stack, g16_stack) because the overall + alignment is > 16. No warning expected. */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 93 } gp_stack */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 94 } g1p_stack */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 95 } g2p_stack */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 96 } g4p_stack */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 97 } g8p_stack */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 93 } gp_stack */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 94 } g1p_stack */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 95 } g2p_stack */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 96 } g4p_stack */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 97 } g8p_stack */ -/* No change in parameter passing in GCC 9.1 for line 98 (g16p_stack). No - warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for line 98 + (g16p_stack). No warning expected. */ /* Bitfield parameter in stdarg. */ -/* No change in parameter passing in GCC 9.1 for lines 101-105 (f1_stdarg, - f2_stdarg, f4_stdarg, f8_stdarg, f16_stdarg) because the overall alignment - is > 16. No warning expected. */ - -/* Parameter passing for these should not have changed in GCC 9.1 (PR 105549). - Fortunately we warn. Note the discrepancy with lines 120-124 below: we warn - in the callee, but not in the caller. */ -/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 9.1} "" { target *-*-* } 107 } fp_stdarg */ -/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 9.1} "" { target *-*-* } 108 } f1p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 9.1} "" { target *-*-* } 109 } f2p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 9.1} "" { target *-*-* } 110 } f4p_stdarg */ -/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 9.1} "" { target *-*-* } 111 } f8p_stdarg */ - -/* No change in parameter passing in GCC 9.1 for line 112 (f16p_stdarg). - Should not warn. */ -/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 9.1} "" { target *-*-* } 112 } f16p_stdarg */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 101-105 + (f1_stdarg, f2_stdarg, f4_stdarg, f8_stdarg, f16_stdarg) because the overall + alignment is > 16. No warning expected. */ + +/* Changed in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'Sp' changed in GCC 13.1} "" { target *-*-* } 107 } fp_stdarg */ +/* { dg-note {parameter passing for argument of type 'S1p' changed in GCC 13.1} "" { target *-*-* } 108 } f1p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S2p' changed in GCC 13.1} "" { target *-*-* } 109 } f2p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S4p' changed in GCC 13.1} "" { target *-*-* } 110 } f4p_stdarg */ +/* { dg-note {parameter passing for argument of type 'S8p' changed in GCC 13.1} "" { target *-*-* } 111 } f8p_stdarg */ + +/* No change for line 112 (f16p_stdarg), no warning. */ /* Bitfield call argument in stdarg. */ -/* No change in parameter passing in GCC 9.1 for lines 114-118 (g1_stdarg, - g2_stdarg, g4_stdarg, g8_stdarg, g16_stdarg) because the overall alignment - is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 114-118 + (g1_stdarg, g2_stdarg, g4_stdarg, g8_stdarg, g16_stdarg) because the overall + alignment is > 16. No warning expected. */ -/* No change in parameter passing in GCC 9.1 for lines 120-124 (gp_stdarg, - g1p_stdarg, g2p_stdarg, g4p_stdarg, g8p_stdarg), no warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 120-124 + (gp_stdarg, g1p_stdarg, g2p_stdarg, g4p_stdarg, g8p_stdarg), no warning + expected. */ -/* Changed in GCC 9.1, but we fail to emit a warning. */ -/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 9.1} "" { xfail *-*-* } 125 } g16p_stdarg */ +/* Changed in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'S16p' changed in GCC 13.1} "" { target *-*-* } 125 } g16p_stdarg */ diff --git a/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-17.c b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-17.c new file mode 100644 index 00000000000..24895c3ab48 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-17.c @@ -0,0 +1,105 @@ +/* Test AAPCS64 layout and __builtin_va_arg. + + This test covers a corner case where a composite type parameter fits in one + register: we do not need a double-word alignment when accessing it in the + va_arg stack area. */ + +/* { dg-do run { target aarch64*-*-* } } */ + +#ifndef IN_FRAMEWORK +#define AAPCS64_TEST_STDARG +#define TESTFILE "va_arg-17.c" +#include "type-def.h" + +enum E6 { e6_0, e6_1, e6_2, e6_3, e6_65533 = 65533, e6_65534, e6_65535 }; +typedef enum E6 Tal16E6 __attribute__((aligned (16))); +typedef unsigned int Tuint; + +int fails; + +union S2844 { + Tuint a:((((10) - 1) & 31) + 1); + Tal16E6 __attribute__((aligned (2), packed)) b:31; + struct{}c[0]; +} ; +union S2844 s2844; +union S2844 a2844[5]; + +#define HAS_DATA_INIT_FUNC +void init_data () +{ + memset (&s2844, '\0', sizeof (s2844)); + memset (a2844, '\0', sizeof (a2844)); + s2844.a = 799U; + a2844[2].a = 586U; +} + +#include "abitest.h" +#else + ARG (int , 1 , W0 , LAST_NAMED_ARG_ID) + DOTS + ANON_PROMOTED (float , 1.0f, double, 1.0, D0, 1) + ANON (union S2844 , s2844 , X1 , 2) + ANON (long long , 2LL , X2 , 3) + ANON (union S2844 , a2844[2] , X3 , 4) + LAST_ANON (union S2844 , a2844[2] , X4 , 5) +#endif + +#if 0 + /* This test is derived from a case generated by struct-layout-1.exp: */ + +enum E6 { e6_0, e6_1, e6_2, e6_3, e6_65533 = 65533, e6_65534, e6_65535 }; +typedef enum E6 Tal16E6 __attribute__((aligned (16))); +typedef unsigned int Tuint; + +int fails; + +union S2844 { + Tuint a:((((10) - 1) & 31) + 1); + Tal16E6 __attribute__((aligned (2), packed)) b:31; + struct{}c[0]; +} ; +union S2844 s2844; +union S2844 a2844[5]; + +typedef __builtin_va_list __gnuc_va_list; +typedef __gnuc_va_list va_list; + +void check2844va (int z, ...) { + union S2844 arg, *p; + va_list ap; + + __builtin_va_start(ap,z); + if (__builtin_va_arg(ap,double) != 1.0) + printf ("fail %d.%d\n", 2844, 0), ++fails; + + p = &s2844; + arg = __builtin_va_arg(ap,union S2844); /* This would fail. */ + if (p->a != arg.a) + printf ("fail %d.%d\n", 2844, 1), ++fails; + + if (__builtin_va_arg(ap,long long) != 3LL) + printf ("fail %d.%d\n", 2844, 2), ++fails; + + p = &a2844[2]; + arg = __builtin_va_arg(ap,union S2844); /* This would fail. */ + if (p->a != arg.a) + printf ("fail %d.%d\n", 2844, 3), ++fails; + + arg = __builtin_va_arg(ap,union S2844); /* This would fail. */ + if (p->a != arg.a) + printf ("fail %d.%d\n", 2844, 4), ++fails; + + __builtin_va_end(ap); +} + +int main (void) { + int i, j; + memset (&s2844, '\0', sizeof (s2844)); + memset (a2844, '\0', sizeof (a2844)); + s2844.a = 799U; + a2844[2].a = 586U; + check2844va (1, 1.0, s2844, 2LL, a2844[2], a2844[2]); + exit (fails != 0); +} +#endif /* 0 */ diff --git a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c index 3e38cac149d..f248a129509 100644 --- a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c +++ b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2-extra.c @@ -7,9 +7,9 @@ #include "bitfield-abi-warning.h" /* In f1, f2, f4, f8, f16, f16p (and stdarg versions): */ -/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 12 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 12 } } */ /* In fp, f1p, f2p, f4p, f8p (and stdarg versions): */ -/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 } } */ /* Bitfield parameter in registers. */ /* { dg-note {parameter passing for argument of type 'struct S1' changed in GCC 9.1} "" { target *-*-* } 47 } f1 */ @@ -17,11 +17,11 @@ /* { dg-note {parameter passing for argument of type 'struct S4' changed in GCC 9.1} "" { target *-*-* } 49 } f4 */ /* { dg-note {parameter passing for argument of type 'struct S8' changed in GCC 9.1} "" { target *-*-* } 50 } f8 */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 53 } fp */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 54 } f1p */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 55 } f2p */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 56 } f4p */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 57 } f8p */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 53 } fp */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 54 } f1p */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 55 } f2p */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 56 } f4p */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 57 } f8p */ /* Bitfield call argument in registers. */ /* { dg-note {parameter passing for argument of type 'struct S1' changed in GCC 9.1} "" { target *-*-* } 60 } g1 */ @@ -29,11 +29,11 @@ /* { dg-note {parameter passing for argument of type 'struct S4' changed in GCC 9.1} "" { target *-*-* } 62 } g4 */ /* { dg-note {parameter passing for argument of type 'struct S8' changed in GCC 9.1} "" { target *-*-* } 63 } g8 */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 66 } gp */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 67 } g1p */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 68 } g2p */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 69 } g4p */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 70 } g8p */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 66 } gp */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 67 } g1p */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 68 } g2p */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 69 } g4p */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 70 } g8p */ /* Bitfield parameter in stack. */ @@ -42,11 +42,11 @@ /* { dg-note {parameter passing for argument of type 'struct S4' changed in GCC 9.1} "" { target *-*-* } 76 } f4_stack */ /* { dg-note {parameter passing for argument of type 'struct S8' changed in GCC 9.1} "" { target *-*-* } 77 } f8_stack */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 80 } fp_stack */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 81 } f1p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 82 } f2p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 83 } f4p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 84 } f8p_stack */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 80 } fp_stack */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 81 } f1p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 82 } f2p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 83 } f4p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 84 } f8p_stack */ /* Bitfield call argument in stack. */ /* { dg-note {parameter passing for argument of type 'struct S1' changed in GCC 9.1} "" { target *-*-* } 87 } g1_stack */ @@ -54,11 +54,11 @@ /* { dg-note {parameter passing for argument of type 'struct S4' changed in GCC 9.1} "" { target *-*-* } 89 } g4_stack */ /* { dg-note {parameter passing for argument of type 'struct S8' changed in GCC 9.1} "" { target *-*-* } 90 } g8_stack */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 93 } gp_stack */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 94 } g1p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 95 } g2p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 96 } g4p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 97 } g8p_stack */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 93 } gp_stack */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 94 } g1p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 95 } g2p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 96 } g4p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 97 } g8p_stack */ /* Bitfield parameter in stdarg. */ @@ -67,11 +67,11 @@ /* { dg-note {parameter passing for argument of type 'struct S4' changed in GCC 9.1} "" { target *-*-* } 103 } f4_stdarg */ /* { dg-note {parameter passing for argument of type 'struct S8' changed in GCC 9.1} "" { target *-*-* } 104 } f8_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 107 } fp_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 108 } f1p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 109 } f2p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 110 } f4p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 111 } f8p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 107 } fp_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 108 } f1p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 109 } f2p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 110 } f4p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 111 } f8p_stdarg */ /* Bitfield call argument in stdarg. */ /* { dg-note {parameter passing for argument of type 'struct S1' changed in GCC 9.1} "" { target *-*-* } 114 } g1_stdarg */ @@ -79,8 +79,8 @@ /* { dg-note {parameter passing for argument of type 'struct S4' changed in GCC 9.1} "" { target *-*-* } 116 } g4_stdarg */ /* { dg-note {parameter passing for argument of type 'struct S8' changed in GCC 9.1} "" { target *-*-* } 117 } g8_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 120 } gp_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 121 } g1p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 122 } g2p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 123 } g4p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 124 } g8p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 120 } gp_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 121 } g1p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 122 } g2p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 123 } g4p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 124 } g8p_stdarg */ diff --git a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c index 39c5f9228ee..268c7aa90cb 100644 --- a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c +++ b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align16-O2.c @@ -7,9 +7,9 @@ #include "bitfield-abi-warning.h" /* In f1, f2, f4, f8, f16, f16p (and stdarg versions): */ -/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 12 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 12 } } */ /* In fp, f1p, f2p, f4p, f8p (and stdarg versions): */ -/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 } } */ /* Bitfield parameter in registers. */ /* { dg-note {parameter passing for argument of type 'struct S1' changed in GCC 9.1} "" { target *-*-* } 47 } f1 */ @@ -17,15 +17,9 @@ /* { dg-note {parameter passing for argument of type 'struct S4' changed in GCC 9.1} "" { target *-*-* } 49 } f4 */ /* { dg-note {parameter passing for argument of type 'struct S8' changed in GCC 9.1} "" { target *-*-* } 50 } f8 */ -/* No change in parameter passing in GCC 9.1 for lines 53-57 (fp, f1p, f2p, - f4p, f8p) (because the argument fits in a single register). Should not - warn, but aarch64_function_arg_boundary would need to take the argument size - into account as well as whether it's passed via registers or the stack. */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 53 } fp */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 54 } f1p */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 55 } f2p */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 56 } f4p */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 57 } f8p */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 53-57 (fp, + f1p, f2p, f4p, f8p) because the argument fits in a single register. + No warning expected. */ /* Bitfield call argument in registers. */ /* { dg-note {parameter passing for argument of type 'struct S1' changed in GCC 9.1} "" { target *-*-* } 60 } g1 */ @@ -43,11 +37,11 @@ /* { dg-note {parameter passing for argument of type 'struct S4' changed in GCC 9.1} "" { target *-*-* } 76 } f4_stack */ /* { dg-note {parameter passing for argument of type 'struct S8' changed in GCC 9.1} "" { target *-*-* } 77 } f8_stack */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 80 } fp_stack */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 81 } f1p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 82 } f2p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 83 } f4p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 84 } f8p_stack */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 80 } fp_stack */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 81 } f1p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 82 } f2p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 83 } f4p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 84 } f8p_stack */ /* Bitfield call argument in stack. */ /* { dg-note {parameter passing for argument of type 'struct S1' changed in GCC 9.1} "" { target *-*-* } 87 } g1_stack */ @@ -55,11 +49,11 @@ /* { dg-note {parameter passing for argument of type 'struct S4' changed in GCC 9.1} "" { target *-*-* } 89 } g4_stack */ /* { dg-note {parameter passing for argument of type 'struct S8' changed in GCC 9.1} "" { target *-*-* } 90 } g8_stack */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 93 } gp_stack */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 94 } g1p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 95 } g2p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 96 } g4p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 97 } g8p_stack */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 93 } gp_stack */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 94 } g1p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 95 } g2p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 96 } g4p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 97 } g8p_stack */ /* Bitfield parameter in stdarg. */ @@ -68,14 +62,14 @@ /* { dg-note {parameter passing for argument of type 'struct S4' changed in GCC 9.1} "" { target *-*-* } 103 } f4_stdarg */ /* { dg-note {parameter passing for argument of type 'struct S8' changed in GCC 9.1} "" { target *-*-* } 104 } f8_stdarg */ -/* Parameter passing for these should not have changed in GCC 9.1 (PR 105549). +/* FIXME Parameter passing for these should not have changed in GCC 9.1 (PR 105549). Fortunately we warn. Note the discrepancy with lines 120-124 below: we warn in the callee, but not in the caller. */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 107 } fp_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 108 } f1p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 109 } f2p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 110 } f4p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 111 } f8p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 107 } fp_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 108 } f1p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 109 } f2p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 110 } f4p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 111 } f8p_stdarg */ /* Bitfield call argument in stdarg. */ /* { dg-note {parameter passing for argument of type 'struct S1' changed in GCC 9.1} "" { target *-*-* } 114 } g1_stdarg */ diff --git a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c index 70671ceda09..a8a50b35e8e 100644 --- a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c +++ b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2-extra.c @@ -11,109 +11,96 @@ /* { dg-final { scan-assembler-times "ldr\tx0, \\\[x1\\\]" 10 } } */ /* In fp, f1p, f2p, f4p, f8p (and stdarg versions): */ -/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 } } */ /* In f16p (and stdarg version): */ -/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 2 } } */ -/* In f1_stack, f2_stack, f4_stack, f8_stack, f16_stack, f8p_stack: */ -/* { dg-final { scan-assembler-times "ldr\tx\[0-9\]+, \\\[sp, 8\\\]" 6 { xfail *-*-* } } } */ - -/* In fp_stack, f1p_stack: */ -/* { dg-final { scan-assembler-times "ldrb\tw0, \\\[sp, 8\\\]" 2 { xfail *-*-* } } } */ - -/* In f2p_stack: */ -/* { dg-final { scan-assembler-times "ldrh\tw0, \\\[sp, 8\\\]" 1 { xfail *-*-* } } } */ - -/* In f4p_stack: */ -/* { dg-final { scan-assembler-times "ldr\tw0, \\\[sp, 8\\\]" 1 { xfail *-*-* } } } */ +/* In f1_stack, f2_stack, f4_stack, f8_stack, f16_stack, fp_stack, + f1p_stack, f2p_stack, f4p_stack, f8p_stack: */ +/* { dg-final { scan-assembler-times "ldr\tx\[0-9\]+, \\\[sp, 8\\\]" 10 } } */ /* In f16p_stack: */ -/* { dg-final { scan-assembler-times "ldr\tx0, \\\[sp, 16\\\]" 1 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "ldr\tx\[0-9\]+, \\\[sp, 16\\\]" 1 } } */ /* Bitfield parameter in registers. */ -/* No change in parameter passing in GCC 9.1 for lines 47-51 (f1, f2, f4, f8, f16) - because the overall alignment is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 47-51 (f1, + f2, f4, f8, f16) because the overall alignment is > 16. No warning + expected. */ -/* No change in parameter passing in GCC 9.1 for lines 53-57 (fp, f1p, f2p, - f4p, f8p) because the argument fits in a single register. Should not warn, - but aarch64_function_arg_boundary would need to take the argument size into - account as well as whether it's passed via registers or the stack. */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 53 } fp */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 54 } f1p */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 55 } f2p */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 56 } f4p */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 57 } f8p */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 53-57 (fp, + f1p, f2p, f4p, f8p) because the alignment that GCC 9.1 calculated for the + underlying type was 32 bytes (above the maximum expected of 16). */ -/* Changed in GCC 9.1, but we fail to emit a warning since GCC 11 (was OK with GCC 9). */ -/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 9.1} "" { xfail *-*-* } 58 } f16p */ +/* Changed again in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 13.1} "" { target *-*-* } 58 } f16p */ /* Bitfield call argument in registers. */ -/* No change in parameter passing in GCC 9.1 for lines 60-64 (g1, g2, g4, g8, g16) - because the overall alignment is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 60-64 (g1, + g2, g4, g8, g16) because the overall alignment is > 16. No warning + expected. */ -/* No change in parameter passing in GCC 9.1 for lines 66-70 (gp, g1p, g2p, - g4p, g8p), no warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 66-70 (gp, + g1p, g2p, g4p, g8p), no warning expected. */ -/* Changed in GCC 9.1, but we fail to emit a warning. */ -/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 9.1} "" { xfail *-*-* } 71 } g16p */ +/* Changed again in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 13.1} "" { target *-*-* } 71 } g16p */ /* Bitfield parameter in stack. */ -/* No change in parameter passing in GCC 9.1 for lines 74-78 (f1_stack, - f2_stack, f4_stack, f8_stack, f16_stack) because the overall alignment is > - 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 74-78 + (f1_stack, f2_stack, f4_stack, f8_stack, f16_stack) because the overall + alignment is > 16. No warning expected. */ -/* Changed in GCC 9.1. */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 80 } fp_stack */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 81 } f1p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 82 } f2p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 83 } f4p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 84 } f8p_stack */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 80 } fp_stack */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 81 } f1p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 82 } f2p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 83 } f4p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 84 } f8p_stack */ -/* No change in parameter passing in GCC 9.1 for line 85 (f16p_stack) because - the overall alignment is >= 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for line 85 + (f16p_stack). No warning expected. */ /* Bitfield call argument in stack. */ -/* No change in parameter passing in GCC 9.1 for lines 87-91 (g1_stack, - g2_stack, g4_stack, g8_stack, g16_stack) because the overall alignment is > - 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC13.1 for lines 87-91 + (g1_stack, g2_stack, g4_stack, g8_stack, g16_stack) because the overall + alignment is > 16. No warning expected. */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 93 } gp_stack */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 94 } g1p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 95 } g2p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 96 } g4p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 97 } g8p_stack */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 93 } gp_stack */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 94 } g1p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 95 } g2p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 96 } g4p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 97 } g8p_stack */ -/* No change in parameter passing in GCC 9.1 for line 98 (g16p_stack). No - warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for line 98 + (g16p_stack). No warning expected. */ /* Bitfield parameter in stdarg. */ -/* No change in parameter passing in GCC 9.1 for lines 101-105 (f1_stdarg, - f2_stdarg, f4_stdarg, f8_stdarg, f16_stdarg) because the overall alignment - is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 101-105 + (f1_stdarg, f2_stdarg, f4_stdarg, f8_stdarg, f16_stdarg) because the overall + alignment is > 16. No warning expected. */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 107 } fp_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 108 } f1p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 109 } f2p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 110 } f4p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 111 } f8p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 107 } fp_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 108 } f1p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 109 } f2p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 110 } f4p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 111 } f8p_stdarg */ -/* No change in parameter passing in GCC 9.1 for line 112 (f16p_stdarg). - Should not warn. */ -/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 9.1} "" { target *-*-* } 112 } f16p_stdarg */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for line 112 (f16p_stdarg). + No warning expected. */ /* Bitfield call argument in stdarg. */ -/* No change in parameter passing in GCC 9.1 for lines 114-118 (g1_stdarg, - g2_stdarg, g4_stdarg, g8_stdarg, g16_stdarg) because the overall alignment - is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 114-118 + (g1_stdarg, g2_stdarg, g4_stdarg, g8_stdarg, g16_stdarg) because the overall + alignment is > 16. No warning expected. */ -/* No change in parameter passing in GCC 9.1 for lines 120-124 (gp_stdarg, - g1p_stdarg, g2p_stdarg, g4p_stdarg, g8p_stdarg), no warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 120-124 + (gp_stdarg, g1p_stdarg, g2p_stdarg, g4p_stdarg, g8p_stdarg), no warning + expected. */ -/* Changed in GCC 9.1, but we fail to emit a warning. */ -/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 9.1} "" { xfail *-*-* } 125 } g16p_stdarg */ +/* Changed again in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 13.1} "" { target *-*-* } 125 } g16p_stdarg */ diff --git a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c index 757a2f1543c..e872de3dbe0 100644 --- a/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c +++ b/gcc/testsuite/gcc.target/aarch64/bitfield-abi-warning-align32-O2.c @@ -10,110 +10,104 @@ /* { dg-final { scan-assembler-times "ldr\tx0, \\\[x1\\\]" 10 } } */ /* In fp, f1p, f2p, f4p, f8p (and stdarg versions): */ -/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w1, 1" 10 } } */ /* In f16p (and stdarg version): */ -/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "and\tw0, w2, 1" 2 } } */ /* In f1_stack, f2_stack, f4_stack, f8_stack, f16_stack, f8p_stack: */ -/* { dg-final { scan-assembler-times "ldr\tx\[0-9\]+, \\\[sp, 8\\\]" 6 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "ldr\tx\[0-9\]+, \\\[sp, 8\\\]" 6 } } */ /* In fp_stack, f1p_stack: */ -/* { dg-final { scan-assembler-times "ldrb\tw0, \\\[sp, 8\\\]" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "ldrb\tw0, \\\[sp, 8\\\]" 2 } } */ /* In f2p_stack: */ -/* { dg-final { scan-assembler-times "ldrh\tw0, \\\[sp, 8\\\]" 1 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "ldrh\tw0, \\\[sp, 8\\\]" 1 } } */ /* In f4p_stack: */ -/* { dg-final { scan-assembler-times "ldr\tw0, \\\[sp, 8\\\]" 1 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "ldr\tw0, \\\[sp, 8\\\]" 1 } } */ /* In f16p_stack: */ -/* { dg-final { scan-assembler-times "ldr\tx0, \\\[sp, 16\\\]" 1 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "ldr\tx0, \\\[sp, 16\\\]" 1 } } */ /* Bitfield parameter in registers. */ -/* No change in parameter passing in GCC 9.1 for lines 47-51 (f1, f2, f4, f8, f16) - because the overall alignment is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 47-51 (f1, + f2, f4, f8, f16) because the overall alignment is > 16. No warning + expected. */ -/* No change in parameter passing in GCC 9.1 for lines 53-57 (fp, f1p, f2p, - f4p, f8p) because the argument fits in a single register. Should not warn, - but aarch64_function_arg_boundary would need to take the argument size into - account as well as whether it's passed via registers or the stack. */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 53 } fp */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 54 } f1p */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 55 } f2p */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 56 } f4p */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 57 } f8p */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 53-57 (fp, + f1p, f2p, f4p, f8p) because the argument fits in a single register. + No warning expected. */ -/* Changed in GCC 9.1, but we fail to emit a warning since GCC 11 (was OK with GCC 9). */ -/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 9.1} "" { xfail *-*-* } 58 } f16p */ +/* Changes in GCC 13.1, we restore the same codegen as before GCC 9.1 . */ +/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 13.1} "" { target *-*-* } 58 } f16p */ /* Bitfield call argument in registers. */ -/* No change in parameter passing in GCC 9.1 for lines 60-64 (g1, g2, g4, g8, g16) - because the overall alignment is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 60-64 (g1, + g2, g4, g8, g16) because the overall alignment is > 16. No warning + expected. */ -/* No change in parameter passing in GCC 9.1 for lines 66-70 (gp, g1p, g2p, - g4p, g8p), no warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 66-70 (gp, + g1p, g2p, g4p, g8p), no warning expected. */ -/* Changed in GCC 9.1, but we fail to emit a warning. */ -/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 9.1} "" { xfail *-*-* } 71 } g16p */ +/* Changed in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 13.1} "" { target *-*-* } 71 } g16p */ /* Bitfield parameter in stack. */ -/* No change in parameter passing in GCC 9.1 for lines 74-78 (f1_stack, - f2_stack, f4_stack, f8_stack, f16_stack) because the overall alignment is > - 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 74-78 + (f1_stack, f2_stack, f4_stack, f8_stack, f16_stack) because the overall + alignment is > 16. No warning expected. */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 80 } fp_stack */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 81 } f1p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 82 } f2p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 83 } f4p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 84 } f8p_stack */ +/* Changed in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 80 } fp_stack */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 81 } f1p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 82 } f2p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 83 } f4p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 84 } f8p_stack */ -/* No change in parameter passing in GCC 9.1 for line 85 (f16p_stack) because - the overall alignment is >= 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for line 85 + (f16p_stack). No warning expected. */ /* Bitfield call argument in stack. */ -/* No change in parameter passing in GCC 9.1 for lines 87-91 (g1_stack, - g2_stack, g4_stack, g8_stack, g16_stack) because the overall alignment is > - 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 87-91 + (g1_stack, g2_stack, g4_stack, g8_stack, g16_stack) because the overall + alignment is > 16. No warning expected. */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 93 } gp_stack */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 94 } g1p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 95 } g2p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 96 } g4p_stack */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 97 } g8p_stack */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 93 } gp_stack */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 94 } g1p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 95 } g2p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 96 } g4p_stack */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 97 } g8p_stack */ -/* No change in parameter passing in GCC 9.1 for line 98 (g16p_stack). No - warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for line 98 + (g16p_stack). No warning expected. */ /* Bitfield parameter in stdarg. */ -/* No change in parameter passing in GCC 9.1 for lines 101-105 (f1_stdarg, - f2_stdarg, f4_stdarg, f8_stdarg, f16_stdarg) because the overall alignment - is > 16. No warning expected. */ - -/* Parameter passing for these should not have changed in GCC 9.1 (PR 105549). - Fortunately we warn. Note the discrepancy with lines 120-124 below: we warn - in the callee, but not in the caller. */ -/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 9.1} "" { target *-*-* } 107 } fp_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 9.1} "" { target *-*-* } 108 } f1p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 9.1} "" { target *-*-* } 109 } f2p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 9.1} "" { target *-*-* } 110 } f4p_stdarg */ -/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 9.1} "" { target *-*-* } 111 } f8p_stdarg */ - -/* No change in parameter passing in GCC 9.1 for line 112 (f16p_stdarg). - Should not warn. */ -/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 9.1} "" { target *-*-* } 112 } f16p_stdarg */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 101-105 + (f1_stdarg, f2_stdarg, f4_stdarg, f8_stdarg, f16_stdarg) because the overall + alignment is > 16. No warning expected. */ + +/* Changed in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'struct Sp' changed in GCC 13.1} "" { target *-*-* } 107 } fp_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S1p' changed in GCC 13.1} "" { target *-*-* } 108 } f1p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S2p' changed in GCC 13.1} "" { target *-*-* } 109 } f2p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S4p' changed in GCC 13.1} "" { target *-*-* } 110 } f4p_stdarg */ +/* { dg-note {parameter passing for argument of type 'struct S8p' changed in GCC 13.1} "" { target *-*-* } 111 } f8p_stdarg */ + +/* No change for line 112 (f16p_stdarg), no warning. */ /* Bitfield call argument in stdarg. */ -/* No change in parameter passing in GCC 9.1 for lines 114-118 (g1_stdarg, - g2_stdarg, g4_stdarg, g8_stdarg, g16_stdarg) because the overall alignment - is > 16. No warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 114-118 + (g1_stdarg, g2_stdarg, g4_stdarg, g8_stdarg, g16_stdarg) because the overall + alignment is > 16. No warning expected. */ -/* No change in parameter passing in GCC 9.1 for lines 120-124 (gp_stdarg, - g1p_stdarg, g2p_stdarg, g4p_stdarg, g8p_stdarg), no warning expected. */ +/* No change in parameter passing in GCC 9.1 nor GCC 13.1 for lines 120-124 + (gp_stdarg, g1p_stdarg, g2p_stdarg, g4p_stdarg, g8p_stdarg), no warning + expected. */ -/* Changed in GCC 9.1, but we fail to emit a warning. */ -/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 9.1} "" { xfail *-*-* } 125 } g16p_stdarg */ +/* Changed in GCC 13.1. */ +/* { dg-note {parameter passing for argument of type 'struct S16p' changed in GCC 13.1} "" { target *-*-* } 125 } g16p_stdarg */ diff --git a/gcc/testsuite/gcc.target/aarch64/pr105549.c b/gcc/testsuite/gcc.target/aarch64/pr105549.c new file mode 100644 index 00000000000..55a91ed6bc4 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr105549.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ +/* { dg-options "-save-temps" } */ + +enum e { E1 }; +typedef enum e e __attribute__((aligned(16))); +union u { + __attribute__((aligned(2), packed)) e a : 1; + int x[4]; +}; +union u g(int a, union u u2) { return u2; } + +/* { dg-final { scan-assembler "stp\tx1, x2, \\\[sp, 8\\\]" } } */ -- 2.25.1