From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x32d.google.com with SMTP id h1so4765554wmd.3 for ; Mon, 05 Sep 2022 00:26:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date; bh=Q/BBl9t0EnobJZOptsdx7uXbYiStvsJxwoKVJDdZgyY=; b=f57zgu8rM2jyZfAw3ufvt7XnhfyB0YEZdGTdCbaxWu2kkkutJtHgKG5PH+h0HJ5mf+ 9kMTDbajlwkfyNcgau3kqYuebFbDaW0eSEqO8T0siY/vMGHlmyr3S0ixiFnO3JUaWCY7 6xnsb+rF1BEn/Qo1d/bf2mvgVtjTS89iSznJ3ejCsZj6ZJhEoNkolfWwVSbVPp0BC7df Pa3ArjSQhQJsyV1MWu4o/n9J7OzVTogQt+K3chVfdyRsoJ1C+z5AL4/a37+WzNrv0rUn EZOqYHBCoSQH9XxfqEtMdq6Nd629/N2/u0X92VFsMOa2nLwsmLQWXOrCJIdBgm3O+LMu 9Urw== 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-Google-Smtp-Source: AA6agR7MPH+Deutah6DKybBxn+kPqQZNYYF/zP6jTM4u6UBq6CltugGNGGOUMxh0roIw5Jnwt65meg== 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 From: Marc =?iso-8859-1?Q?Poulhi=E8s?= To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek Subject: [Ada] Create internal type for null array aggregate as an itype Message-ID: <20220905072612.GA1174806@poulhies-Precision-5550> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="wac7ysb48OaltWcw" 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 List-Id: --wac7ysb48OaltWcw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --wac7ysb48OaltWcw Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" 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); --wac7ysb48OaltWcw--