From patchwork Tue May 10 15:02:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Lyon X-Patchwork-Id: 53742 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 84BC53955CAD for ; Tue, 10 May 2022 15:03:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 84BC53955CAD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652195036; bh=e0V/Zq+Bhs5T1FtWQG3cb4+fkTgqknuZV9KuFEsebkE=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=aoBHK6MUCkdz5MVV6D5gsCeqNhfzLcyyJobw/xj8uJ7YYaOv8m/leFj5QAXw57/Ca AqoYX4g02fuX205gy6wwpdd85eJBiQ/BMmw90/iDb5EdAXrObpT0jmKCh4qY4QR3yU pFchWdKW8gKN0aa0vtFvVvA9w0BETzlCI7EA8Gxo= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2063.outbound.protection.outlook.com [40.107.20.63]) by sourceware.org (Postfix) with ESMTPS id F30733955C82 for ; Tue, 10 May 2022 15:03:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F30733955C82 ARC-Seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=lmhUJg+wIyUgnHHj3a6ulR5wBeTycBX9Mn1LV5CvNietOUlFS6RaiIC61vPsRBDbRfg2BobRNrloYxdOwNUxdHrhxTli208I05DuQHIOyuIGO7aJMhD3E54Q66ZT4781tHgsWx4SUY+agAeuKEopn9OUENoSPgcXtIMuP5HndYlpHiWWroumy6SVke82kDfp0KX/CkIMdyqBCUON6Isk8LmmFZGxsrudjkgvMHXnSumIuQ1AEtcmu9EA2uMzWQiNt5vs+YKlW8h2wF+JF8aeeU1geUCQ368DmmZmqp6ShVWdJQCCd1uksSR05XASJryBa4NjFRi9RmKC6kmjJWw3Hg== ARC-Message-Signature: i=2; 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=e0V/Zq+Bhs5T1FtWQG3cb4+fkTgqknuZV9KuFEsebkE=; b=JerdT9cXXIweop7IflQoOyfiXB0BLk8fAXSL2aXxSkB/kyTFwG2guQbLLH6eTA4N4TtQUy1rwAFey5hx5RkP2g0GmWQ/3gbYW0gv/0CYQ4vZDEKbTBGSyx/6gA4Ylj6OJf6XtbII4mFSY4MHi0GcvRVhLFIdgYUub50i0ZmLVSnE5IYgJKaibm+G9bbC4nAw0FSRLp/z3IYraNMp8hvk3C4+J3raKUUF3HvcJeJNSLM6OlfzvCW4qoXdj0JkuJYfsknJZFXAuwLzbMyTTkqpS39JOPEXwVRkf7n+H/8q8nOWNLYcihAy9NDmtjfQTluLkH1hnb53I1zvjmOxB16Eqg== ARC-Authentication-Results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dmarc=[1,1,header.from=arm.com]) Received: from AM7PR04CA0026.eurprd04.prod.outlook.com (2603:10a6:20b:110::36) by AM9PR08MB7274.eurprd08.prod.outlook.com (2603:10a6:20b:435::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.22; Tue, 10 May 2022 15:03:10 +0000 Received: from VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:110:cafe::9b) by AM7PR04CA0026.outlook.office365.com (2603:10a6:20b:110::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.23 via Frontend Transport; Tue, 10 May 2022 15:03:10 +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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by VE1EUR03FT055.mail.protection.outlook.com (10.152.19.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.15 via Frontend Transport; Tue, 10 May 2022 15:03:10 +0000 Received: ("Tessian outbound facaf1373bbd:v118"); Tue, 10 May 2022 15:03:09 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6f6877e923f365d4 X-CR-MTA-TID: 64aa7808 Received: from 70267d045825.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 4DCE5164-1C90-4EF1-8807-81979967FD55.1; Tue, 10 May 2022 15:03:03 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 70267d045825.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 10 May 2022 15:03:03 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WUZVmhpNb12+pL8KIrNEMRVsevWB9oJklRjFkoHOHG1OKMibnuWQ4kzqyaLOtMdCymqwunSqocpJxfgcf5o/e6Oq2I5m66qR+PMxuzYqRXMQC3OTEQ5vbK/hzaU5s4A/MmLY3JKa3j9rG9W85XDYYlVecETEokGikn2gtU4DY4Jg31rFmweRTMWmvw/jUnIU2WLGsDVAu0UOpJqrb8OXugteDoay74KQ2P9xJajA/8MkZ/qzxUllcHG6kcyCp3Px8Xnw0FFn3BUAclPfnInDlslawOdmy+hO9lmSXT3QPO8GV0Ns3ttotz5iT9//EuRFATTckVjk/K0MTkOr/1KKQw== 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=e0V/Zq+Bhs5T1FtWQG3cb4+fkTgqknuZV9KuFEsebkE=; b=IkJXrgk9lx9Ay4tJfiuUigLZy49IC0sBiYdKIXpSOivgQ/faW//zI+K3dNF1PU4eSFs2T03SXxhwGeXU6FepcNxU7F+AaXQP8afbdlv8lEeHBbyIgFnpG7O6YCNi4+LskTAyG7zWA2FdITB+TynuBIuzLnkoPhM4VjPPMrdmYVt4kD23y34lbnR2gXO8fGtBvyJEbOBZPoNniQcRl7lc9Ha+QWgSfdtmG1kOBpLDn+7MRD2a1OW3YYTM+W3niGNllB7u1j7OgOAgoAjRILnqF0fab0JVAIUL9q1nhXSdyA7ilZZAmfeQw9R7huRYC/T6JzHpD1enr8tmWiRXwr7EWQ== 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 Received: from AM7PR02CA0022.eurprd02.prod.outlook.com (2603:10a6:20b:100::32) by VE1PR08MB4942.eurprd08.prod.outlook.com (2603:10a6:803:10f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.20; Tue, 10 May 2022 15:02:53 +0000 Received: from AM5EUR03FT038.eop-EUR03.prod.protection.outlook.com (2603:10a6:20b:100:cafe::56) by AM7PR02CA0022.outlook.office365.com (2603:10a6:20b:100::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.23 via Frontend Transport; Tue, 10 May 2022 15:02:53 +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; Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT038.mail.protection.outlook.com (10.152.17.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.5227.15 via Frontend Transport; Tue, 10 May 2022 15:02:53 +0000 Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) 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.2308.27; Tue, 10 May 2022 15:02:58 +0000 Received: from e129018.arm.com (10.57.81.162) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2308.27 via Frontend Transport; Tue, 10 May 2022 15:02:57 +0000 To: Subject: [PATCH] aarch64: Fix va_arg alignment handling (PR target/105549) Date: Tue, 10 May 2022 17:02:28 +0200 Message-ID: <20220510150228.250435-1-christophe.lyon@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-Correlation-Id: ba5f25b3-a4ac-4353-c429-08da329632a8 X-MS-TrafficTypeDiagnostic: VE1PR08MB4942:EE_|VE1EUR03FT055:EE_|AM9PR08MB7274:EE_ X-Microsoft-Antispam-PRVS: 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: KkspAR7EZGsxSFQsF26lyxnjcYD4vJ1cBgo9AZolfatgptMobfy0GgInIvKbGTlQDqDKAQpz/7DoRJhGf8IIGoHU43Y2YI8NQPrR3iAeI3CX+gKHLI4oTmZ7Cg3Hi2YULy3/HJfC0jn7Eif5Jli5rrdR+vaexM74OvOEG/ZNSioTxzjqVWe1NO8W82xeQoX8SvKzDOl9T/ZQ33yB8Cw7dKJfH2ourCf4zQfQiTqE+S2MDCDngk/Z6WSygLYXD/DUZMeVV9g/per9rzCJ/Omi8ZWGOYcXc8MQRSeCyOuf72kKhL56yOg7HS+bywJeA89VU2MFnmCouq41czEoqQZNFKwlZUCVyXi3SjYr+YRWxr+M7ZEkzQpbj/v3Dk6N5xlhYbsKH0nxD3AXfxQ0BWKlex2yYhwJQznba6qgapVWfstmWAARK64EGe6jARcKaLURCKPOZRY7tp8o+SBdqll0z0CZgxHQs/xXTIMJg4bxisM+Qmcg2DYP9C5ciCVoxtXh77zuUecFjppAw0BPCzV3GjTpAwMM4DEuuXjQgBlHzouxlsGtle8mzVX35VL4SVPt6wLwWhdRwGwauBd6cUH2WuSZAuXgrAY4vl60FQlLsmUrph29KOqVx8DGDnMghyUZ0Vhn3uHFJ4IN7cDMeR52a6h3V70HTlOeNtSRLhsncOtBS601zj89CM2UVwOU1odAEx9lmmL4G5vS+754DTaD52eDd05J5dKKEEQ3CJSD+rCJ9as2YLtZs14C3ZtFblly+FDEC9wznhjoDWXsXdXrRRUjX19ePSmqc+mmnVABjwXJ4GcUSwHxG/WuffDaNplwcicvgXU/fOt+KAz9RF5BWQ== 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:(13230001)(4636009)(46966006)(36840700001)(40470700004)(6666004)(316002)(36756003)(36860700001)(8936002)(6916009)(2616005)(1076003)(426003)(47076005)(186003)(83380400001)(356005)(82310400005)(336012)(40460700003)(4326008)(8676002)(81166007)(70586007)(86362001)(84970400001)(26005)(70206006)(508600001)(7696005)(2906002)(44832011)(5660300002)(36900700001); DIR:OUT; SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: VE1PR08MB4942 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: a376c1f2-8275-4ddb-a7fc-08da329628c2 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sowy9+nUM/F3qiWVDJ5jC68FEIJ2Yi9X99CfLPCJe8rHfODkM2KTYU6xvGI2PRzocol9hrL6/9P8yoZQkWArrhYopHOJSrCV2w0lP+M05nCQH/w8neCKCJT6ozduMbptymPQLnYCIByJIFWkx2lSuqXL5pLOf6sW7Rg3LNekm2t5wL688eF0jr2QAyTlnnkpM7bnmh498AUffiJ3Uj9WzJgfqfK6v5127SuR5r18nQZmBgvOgMwdAeG6FFjuUSsGtVbE7a0MxgNXwHHesGhf05nU46nslp1r+AZXY7FTYsS0YfcMFlHLtzwnvUQiT9GZZZknCHZP5MZ9+2FZ7T+3zJ5Kgr1VvgDI3UKlQwcYglpWvVVnqzNuaOYNs+Aa9CWLYNKNBgzM4yhJ/JCL98emO5U3gz2L8FAm/mYDIa68WsMuYB/lkgY17AQ0V7Mic8itlCmoYzr+UaBDG02KRX7fLH4Q8BchWaCQN1yBAyRwJrA7pMuKNtWaSdhiXpBPvl8XwqM1/G0HqmVP4ci2a9eaACSbmnWU68JxMfVDovRm6ALwGHw8NJpo/Kal8okK/gLvrJDVdOevW0lvgcqlkzXGVpmgnnIQf/oBUjvMrkUeKIOd7XigORnm7q7n2nlDIhEnMch8JZrt+LYFcRIeYgbioI2DtXHTEZ7mTXup9iT1iO/f+xltXoeLRRAwwdIILFjIAfxMjoknPay5jWSzMVFoBjY+rJWaeM8ywY6BnT+HKy6VR0t0urf2FjCFHDiQTdHs2w+0/WDABtGqGF222Vh/a1wJCtPWNrz2uof9LPZD+g2aflmII+HCs3LUfHUIvjQ7 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:(13230001)(4636009)(40470700004)(46966006)(36840700001)(83380400001)(82310400005)(44832011)(36756003)(2616005)(7696005)(81166007)(8936002)(70586007)(70206006)(6916009)(8676002)(4326008)(426003)(47076005)(40460700003)(84970400001)(336012)(26005)(36860700001)(508600001)(2906002)(5660300002)(186003)(6666004)(86362001)(1076003)(316002); DIR:OUT; SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 May 2022 15:03:10.1813 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba5f25b3-a4ac-4353-c429-08da329632a8 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: VE1EUR03FT055.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR08MB7274 X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Christophe Lyon via Gcc-patches From: Christophe Lyon Reply-To: Christophe Lyon Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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. This is a tough case mixing bitfields and alignment, where aarch64_gimplify_va_arg_expr did not follow the exact same rule as aarch64_layout_arg. When the va_arg parameter uses only one general register, we do not want to introduce double-word alignment. The fix is thus very small, and this patch adds a new test (va_arg-17.c), which contains the reduced offending testcase from struct-layout-1.exp for reference. 2022-04-25 Christophe Lyon gcc/ PR target/105549 * config/aarch64/aarch64.cc (aarch64_gimplify_va_arg_expr): Fix alignment of single-register parameters. gcc/testssuite/ PR target/105549 * gcc.target/aarch64/aapcs64/va_arg-17.c: New. --- gcc/config/aarch64/aarch64.cc | 4 +- .../gcc.target/aarch64/aapcs64/va_arg-17.c | 105 ++++++++++++++++++ 2 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/aarch64/aapcs64/va_arg-17.c diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc index f650abbc4ce..bd855758778 100644 --- a/gcc/config/aarch64/aarch64.cc +++ b/gcc/config/aarch64/aarch64.cc @@ -19667,7 +19667,9 @@ 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) + /* Align on double-word only if we need 2 registers, like in + aarch64_layout_arg. */ + if (align > 8 && nregs == 2) { if (abi_break && warn_psabi) inform (input_location, "parameter passing for argument of type " 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 */