From patchwork Mon Sep 5 07:26:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 980 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp59044wrt; Mon, 5 Sep 2022 00:37:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR4tIj2pviHEr/tsjft143r2ANBC1Dsm2EHm4u9k860RIC+dm1ntx/JCouuidlh3o45l8zY6 X-Received: by 2002:a05:6402:51ce:b0:43e:74bc:dce with SMTP id r14-20020a05640251ce00b0043e74bc0dcemr43225755edd.225.1662363463148; Mon, 05 Sep 2022 00:37:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662363463; cv=none; d=google.com; s=arc-20160816; b=fNMSJPWzPmiG6Y3fMAUT+ja9761a1f68VcFoT/e1m78qhzFyamnQPr91v1+R46SKHI aHsksIINacc96McNCg6FxQzbbCYr+KGq8Ca11/yBRgTT4n/WxPvIVuK4q7CxoCnTOMyf Dsmjn/BB6NAf2DlqTrj6HaXw8X4NzKlGOHajbGK3lOwwcvA77YVKYdc1PffIX4C4tWJK tljGePJqrhJHglPnrWIlN9ccdIvzALJregDZIfZ1uZpX0lGlolq8dHrzPfoizCkTr4wN XehlqvvxNt7JAHrJEjuj1P4Z7zovVDpDnT7pd/bZ+OeCJhtIIrPcI/beoenwk7OQfgS9 590A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=Q/BBl9t0EnobJZOptsdx7uXbYiStvsJxwoKVJDdZgyY=; b=Qe7cha0k+D7GZH6kOOYh/Na/aU2BGT7JdGftf9/gRGTZh3LHJsjSqX1oWlqk2Bx5TK hSmBYHPj5o+0OXRSPxpc853Fgxd2XQchxdCTHr3MErKXD039qOcHwr6L4GrxxcwSbsJj BpyS+vgTiVDXp4zHiLoVzcR7ARGp4b2KBNF9vnUo0byEGF5QXSPS1qTWEQU//BYhJhq5 lk7zskRNdP2Ej6+x/PG6frVtcZsZOeIHyf0R0cNbadt88Qg/Ou7SOPSStTgX4KAhhTuq ATqTsskutr1zBw0uQNF5SWu+RImrx0nh8fsVzoo1IpPogLVubep3GhdZbP+pefopZOi9 7SOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=KS+8aXHK; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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. [8.43.85.97]) by mx.google.com with ESMTPS id r4-20020a17090638c400b00741757d6293si6371991ejd.260.2022.09.05.00.37.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 00:37:43 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=KS+8aXHK; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 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 A65E23856090 for ; Mon, 5 Sep 2022 07:31:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A65E23856090 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662363102; bh=Q/BBl9t0EnobJZOptsdx7uXbYiStvsJxwoKVJDdZgyY=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=KS+8aXHKLj/f/BL5Gx6QP7T/QlvnzZ1+Zd1GK8FB1SQlotjKjPsureLh6xpbf7ww0 XuoN7Umki5DLdz4mJf+h4aVpfJcG5QaI9gRPJa6Rc4cZfm9DKGWRb+H3gJtq6yR2kQ +TjEwopiO8c0Ro35bESufHjRK3h4bh+mjSGWUKIM= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 827943856970 for ; Mon, 5 Sep 2022 07:26:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 827943856970 Received: by mail-wm1-x32d.google.com with SMTP id h1so4765554wmd.3 for ; Mon, 05 Sep 2022 00:26:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=Q/BBl9t0EnobJZOptsdx7uXbYiStvsJxwoKVJDdZgyY=; b=YsDkm7mMHqMdEMOwAdpikjKfWxOf+epCzpt1mxoNZOVeaaDzMucP1yePAcdWAzc4uz p8Tl+K2rpI9N8QNNpW9uTruRjWln1hCuUtrn9MgaHpLUyltn/87LVesMfHUpGhC/T7nI jijWWjmYVeXGPW24xAWJsAzMIX8hwIUVvxsW1/VFq6rEuEr/rX+IYBQgXcMLNLrID+vd WF+ZhZ4TkvPaqofkFhZXgsfpJzrNqbHextKRzmBqeW0gQ7Z8mWEkrlbzoMo9ZHnrNwtO AYdp4sQRWwuTiQD1H/oCFpghkEXgESNY2VCMr4uIPuvT2mWFcn3elsqTL1k7eL2nQMqF x6Mg== X-Gm-Message-State: ACgBeo0FcmBU9dEonwcRsPI4MnTkQHiAaOnnT8yjE30QKMMLtPwt7ZyD 6EaWJEsQ2RsmdBoHJVh6jVnscBoXDjzEBQ== X-Received: by 2002:a05:600c:19d1:b0:3a6:14e5:4725 with SMTP id u17-20020a05600c19d100b003a614e54725mr9516162wmq.141.1662362773444; Mon, 05 Sep 2022 00:26:13 -0700 (PDT) Received: from poulhies-Precision-5550 (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id d1-20020a056000114100b00228c483128dsm511802wrx.90.2022.09.05.00.26.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 00:26:12 -0700 (PDT) Date: Mon, 5 Sep 2022 09:26:12 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] Create internal type for null array aggregate as an itype Message-ID: <20220905072612.GA1174806@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: Marc =?iso-8859-1?q?Poulhi=E8s?= Cc: Piotr Trojanek 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?1743114430734801558?= X-GMAIL-MSGID: =?utf-8?q?1743114430734801558?= Internal type created for the null array aggregate of Ada 2022 was created as a temporary entity and then flagged as internal, but it is better to create this type directly as an itype. In particular, when the null array aggregate appears in a spec expression, its type declaration will not be attached to the AST. An itype will have Associated_Node_For_Itype, so that the context of the type can be recovered, which is what GNATprove does. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_aggr.adb (Resolve_Null_Array_Aggregate): Create internal type for the aggregate as an itype. diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb --- a/gcc/ada/sem_aggr.adb +++ b/gcc/ada/sem_aggr.adb @@ -4088,7 +4088,10 @@ package body Sem_Aggr is Index : Node_Id; Lo, Hi : Node_Id; Constr : constant List_Id := New_List; - Subt : constant Entity_Id := Make_Temporary (Loc, 'S'); + Subt : constant Entity_Id := + Create_Itype (Ekind => E_Array_Subtype, + Related_Nod => N, + Suffix => 'S'); begin -- Create a constrained subtype with null dimensions @@ -4134,7 +4137,6 @@ package body Sem_Aggr is Make_Index_Or_Discriminant_Constraint (Loc, Constr))); Insert_Action (N, Decl); - Set_Is_Internal (Subt); Analyze (Decl); Set_Etype (N, Subt); Set_Compile_Time_Known_Aggregate (N);