From patchwork Mon Sep 12 08:19:31 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: 1145 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp1780789wrt; Mon, 12 Sep 2022 01:27:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR7lbXh2mxqtX0vvvqOIcor7lcbSdihiliqodFiY0ra8WJOBnsStdXfh0wpDTigaWDL8cTWn X-Received: by 2002:a17:906:8463:b0:771:a3d2:7c3 with SMTP id hx3-20020a170906846300b00771a3d207c3mr15134640ejc.592.1662971274576; Mon, 12 Sep 2022 01:27:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662971274; cv=none; d=google.com; s=arc-20160816; b=xD7Ig8868HQzAUal395Kk6B+Y3ZK6rCKmZdtgVjQbXDde8SEit1GsHB9nyUkdpVQYE N2N+rIMIMwP572qkzK+9g1ww8Mnvb6btJwYSa2dUzl5V6/yVOr2P+mWGujE9lqr2aGoZ UZfjbE0ZSwzcHRhT5LuiNoIA+febANG6by7Mh2T16k7A0rnf8G1ipESnzGkrm3jcsftY bKEREa3D7xdya9fMkhk9MPwlEQ5bMRR/Jq0g9M43J1P29/YOFGBVoosAbhfyiqBk1W27 M/k5SWyXX1WTKm9qDBPA53RjffzR9gxLaw7zvS2mTMOqaaiBWpLShdR/Bs3igXCk/5Ox 95rg== 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=+KD/Pdm3dYU9QzyG+8mRBpBWapmZ1wkGdx199og1aLs=; b=N54BEx9g8nC3kR+9sjrHT1Fr0lGX3m2VtbTFXKJbIBWlYwfQygq4bBX9d9AZJ5RzuG +V6ROVJS+88uBLFCiUy6SVk6eYbxgVDJ8K0txLKxkkoX2uIwMNsu6BeZyDczwba3JNow lblO1lz/oyNF8gVBgHsJtR/Bj8/1+M6AjzaxCUk4nSGMDSbGvMpIqrKJpPlCVxEV88q8 n1zskXmcKIrjqHwd8evCvCB74tUBPXTplTzZX3FMDD+acw5ZNiw45nlStmWV7mBr6+qV kmN3BhpvcYbUe7Mmtwq25HYgFPkG3JfAn/KaIJFbVlA7aKkr4LpsLSIXuPZUy6WorHMM YZZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=aT+H9Wv4; 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 (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id d11-20020a056402400b00b0044ebf99d6f9si6011316eda.263.2022.09.12.01.27.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 01:27:54 -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=aT+H9Wv4; 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 7818D3955C9E for ; Mon, 12 Sep 2022 08:23:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7818D3955C9E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662970994; bh=+KD/Pdm3dYU9QzyG+8mRBpBWapmZ1wkGdx199og1aLs=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=aT+H9Wv4iMK7c8AP3HN9bu77ghh3KEMbZC/EPN+06T5Ugz1Y9S/pvZ2E/rTynAcBj G1RwKtWKeDydyKVdCJsE2f2j428XZYveKumo2qzanZ+dPAcdYDh+n9pBB+LhNX1p53 d3MexaR0y12sypSISz4VkYVvOP1UtZJbuIPYLI3s= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id D1E1C385115C for ; Mon, 12 Sep 2022 08:19:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D1E1C385115C Received: by mail-wm1-x336.google.com with SMTP id m17-20020a7bce11000000b003a5bedec07bso10459252wmc.0 for ; Mon, 12 Sep 2022 01:19:33 -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=+KD/Pdm3dYU9QzyG+8mRBpBWapmZ1wkGdx199og1aLs=; b=8RxSnWKlvMe/naepMkyXFCRBD411RBC2G+rnozBvJJOoZa68It914iUyhTzawKdu9J 631Uy+V/BUyCO6X84agaf8OlofG6mhmgv5cqROauE9OZNuzYWqQe+NglpypAinaI6Vnk 9dAdD5nQ/GkzHtefAqflSGe4YsDk288ic9fCdS8jpH13UjDkzbRZH8qOXUdOVtfWBjkh WfNkTu1yMEsokZEfHgk+beJdFkxefQJOZE0LjQU6zxF8pzD9jGYEF0NvLgHUCXbS3/f1 l+6Y3ZxpyLQjqzrXnzg2zosQtdN7yWcwjw+IflLoCWohNNpldLXFZ260B++546CSolj8 L8fw== X-Gm-Message-State: ACgBeo2fVu9WkP5cNytWSlaazUsbPcU/+t4jMhayxVUTCc94f7yx9MZt JIx8trFGjTbw4xvcpblkzLBlffsWMepIXA== X-Received: by 2002:a7b:ce0d:0:b0:3b4:8728:3e7e with SMTP id m13-20020a7bce0d000000b003b487283e7emr2059019wmc.182.1662970772686; Mon, 12 Sep 2022 01:19:32 -0700 (PDT) Received: from poulhies-Precision-5550 (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id n22-20020a05600c3b9600b003b435c41103sm10987161wms.0.2022.09.12.01.19.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 01:19:32 -0700 (PDT) Date: Mon, 12 Sep 2022 10:19:31 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] Internal error compiling formal instance of generic with Initial_Condition Message-ID: <20220912081931.GA1512981@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.7 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: Steve Baird 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?1743751767304366337?= X-GMAIL-MSGID: =?utf-8?q?1743751767304366337?= Prevent the compiler from failing with an internal error in some cases involving an instance of a generic which takes as a formal parameter an instance of a second generic, where the second generic has an Initial_Condition aspect specification. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * contracts.adb (Analyze_Package_Contract): Do not analyze the contract of a temporary package created just to check conformance of an actual package. diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -1319,6 +1319,18 @@ package body Contracts is if Present (Items) then if Analyzed (Items) then return; + + -- Do not analyze the contract of the internal package + -- created to check conformance of an actual package. + -- Such an internal package is removed from the tree after + -- legality checks are completed, and it does not contain + -- the declarations of all local entities of the generic. + + elsif Is_Internal (Pack_Id) + and then Is_Generic_Instance (Pack_Id) + then + return; + else Set_Analyzed (Items); end if;