From patchwork Fri Apr 14 18:18:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 83553 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp575513vqo; Fri, 14 Apr 2023 11:19:20 -0700 (PDT) X-Google-Smtp-Source: AKy350ZWVe0fBvi0s+nMDXmkTrW5pVFrictQjJNmecOEEo3I4XGYMKVttTJt1lJX1/P/vO5T4T7t X-Received: by 2002:a05:6402:8d2:b0:502:24a4:b0ad with SMTP id d18-20020a05640208d200b0050224a4b0admr6967712edz.4.1681496359996; Fri, 14 Apr 2023 11:19:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681496359; cv=none; d=google.com; s=arc-20160816; b=RukwfvwDenRQFD8FfXs1XTf/+TpNXV76xZaNg7k5H+u5aYH8C2cQVAAd8PK/5oZP2h Cl+CYHrPPOfLI0v+DCQuggNmO60m7DObCecRKc/sH2XJXwa5mUyUqt15B6KSkBfnMM1d iAZLYaN0+6Fk5cSo9JXGmUY4cGeyZKPJMiwvfD+WTGfatjEhInC4RO/85SghMv6sCbdq k+9rRIwOLZGFjRvAnXIEaiuwGzbVLoTghe6LmG0JlgvEa6a/U6dnAHPpl/GvbpVKvva6 BGeRyqu0Sh3ylTEQCtzLXyjYJHfMvWKP6fks1ispx+XlxIovHcmLePhuCTkEHS3EVYzl gDkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=rIy8iYIfinz6yPoSBQCbIPkwsYoyWoTihf5Ay63ulyQ=; b=EIpuRaZeaVsGd12kx8DF5iFhhwLY/sw2D0yrj2PW8yiG7+UFYsErdl98L0x1qC7Y21 coIgnXIMnkD6jHigcb11Al/1PZuxkem5Y/9f/niYUDhVf8QdcdOYe1IW5jhLUxhfYb/v UIy8tirDTnsDN1gscWf2EwlErn2TfBy9r93bDSqfwWhegObjGqu2ev98YIRw6VINchN6 zuq8Z6YP6pu18l4+ivGee3GRbRLgmCuoBdVFPaUvFaIhQpbaCldMN+LXJmhPJXqfboNP XcwNoSAkOOLCBPALwefmLQOzBwLs7+ue1/oLPxFReYhtoY+8Rf+H1Iz7NfhQzMvZQfwv B8XQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=LZPvAJ6o; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id s2-20020aa7c542000000b004fbf06895ffsi4320359edr.329.2023.04.14.11.19.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 11:19:19 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=LZPvAJ6o; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 070D5385842B for ; Fri, 14 Apr 2023 18:19:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 070D5385842B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681496357; bh=rIy8iYIfinz6yPoSBQCbIPkwsYoyWoTihf5Ay63ulyQ=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=LZPvAJ6o0XzN+xcXf56MS3T8Hpa5mpACan0Rv/CgFju6KTe5RRxvIc0vm8qK5xmtN nNtQlDiCQUXK72RH5ulGEqbMB3TOR7eQjNEFDb/HysFpWIhkMKhC+j0jiX0PtghbPy qUr2iHCoj1JufRJgS/N6kDkA6/eB6bmPR4ruA92s= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by sourceware.org (Postfix) with ESMTPS id 9BE74385841D for ; Fri, 14 Apr 2023 18:18:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9BE74385841D Received: by mail-wr1-x436.google.com with SMTP id s12so9941110wrb.1 for ; Fri, 14 Apr 2023 11:18:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681496311; x=1684088311; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=rIy8iYIfinz6yPoSBQCbIPkwsYoyWoTihf5Ay63ulyQ=; b=jEGiyPWG/Xi2muj1FHMXilM9TwLKnUniRFXfZ4aBYNfOjaeOkVN4BGadZPHS/RneZ5 JmJWYMFVJD8Q4tbQjaVubk4gUDeH4Kb4amj8QiNbo2pfcePHL83iI7z7bReFElsKHE0/ fl9VAdIOvkZW0Nv1ZfoBpFpX24gGy4kvvChVDF/xcMNlmP2JP6V6xreE4hr+O1V1obG3 0afqSQd1nPrpqt/h17y9HGW1YthNJIoRgtCD6XzcO6LAqeHaoc3ZHOlHtkqxVlSHXu7z fnL8N51QeV2vCslsbMBWWUyv8N9En9tcsdLSnU1q5hsVKVOSzsEFFqQIIy5T6FWO/K/J 3UKQ== X-Gm-Message-State: AAQBX9eCW5D/Mffv2+Zq9TV1OmydiH/48IUE8MK5v9BmGNzO29p4pLtj 9gnpDPgMa9gUhv6Lw1usIzINaU5VQdX/BoCmvIwyQw== X-Received: by 2002:a5d:6291:0:b0:2f4:215a:98c5 with SMTP id k17-20020a5d6291000000b002f4215a98c5mr4970787wru.70.1681496311308; Fri, 14 Apr 2023 11:18:31 -0700 (PDT) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id s15-20020adfea8f000000b002d1801018e2sm4074188wrm.63.2023.04.14.11.18.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Apr 2023 11:18:30 -0700 (PDT) X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix PR bootstrap/109510 Date: Fri, 14 Apr 2023 20:18:30 +0200 Message-ID: <1927733.PYKUYFuaPT@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-10.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Eric Botcazou via Gcc-patches From: Eric Botcazou Reply-To: Eric Botcazou Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763176727124922375?= X-GMAIL-MSGID: =?utf-8?q?1763176727124922375?= This is the build failure of the Ada runtime for Aarch64 targets. The Aarch64 back-end now asserts that the main variant of scalar types has TYPE_USER_ALIGN cleared, and that's not the case for scalar types declared with a confirming alignment clause in Ada. Tested on Aarch64/Linux by Richard S. (thanks!) and on x86-64/Linux by me, and applied on the mainline. 2023-04-14 Eric Botcazou PR bootstrap/109510 * gcc-interface/decl.cc (gnat_to_gnu_entity) : Reset align to zero if its value is equal to TYPE_ALIGN and the type is scalar. Set TYPE_USER_ALIGN on the type only if align is positive. diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index d24adf33601..851a6745f77 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -4364,13 +4364,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* If the alignment has not already been processed and this is not an unconstrained array type, see if an alignment is specified. If not, we pick a default alignment for atomic objects. */ - if (align != 0 || TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE) + if (align > 0 || TREE_CODE (gnu_type) == UNCONSTRAINED_ARRAY_TYPE) ; else if (Known_Alignment (gnat_entity)) { align = validate_alignment (Alignment (gnat_entity), gnat_entity, TYPE_ALIGN (gnu_type)); + /* Treat confirming clauses on scalar types like the default. */ + if (align == TYPE_ALIGN (gnu_type) && !AGGREGATE_TYPE_P (gnu_type)) + align = 0; + /* Warn on suspiciously large alignments. This should catch errors about the (alignment,byte)/(size,bit) discrepancy. */ if (align > BIGGEST_ALIGNMENT && Has_Alignment_Clause (gnat_entity)) @@ -4666,7 +4670,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) TYPE_BY_REFERENCE_P (gnu_type) = 1; /* Record whether an alignment clause was specified. */ - if (Present (Alignment_Clause (gnat_entity))) + if (align > 0 && Present (Alignment_Clause (gnat_entity))) TYPE_USER_ALIGN (gnu_type) = 1; /* Record whether a pragma Universal_Aliasing was specified. */