From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 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-x336.google.com with SMTP id m17-20020a7bce11000000b003a5bedec07bso10459252wmc.0 for ; Mon, 12 Sep 2022 01:19:33 -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=+KD/Pdm3dYU9QzyG+8mRBpBWapmZ1wkGdx199og1aLs=; b=YJYfq5OTMAR//b8aYu/6d983Yq51iBRA/hxrQTazrToXynMWcFsdbPJlhd/Wl5AY1T xkyVf2n9x3Q5LNHOsa5KpCjyLXgAxJuM3Ab8t7U/B+rLnNcc22fDutStPleYTrIQpfnz Gf9IZrD/jDwsKqQFr/Ix6+XOP4CAy3ocd7LC+sr918qUdOrNzMSXQaBLhiDhWLtF6ZlU vJHy7yaxBt4Hx5fTtrd6LO4wiUGXto14DLpVKTtv+6TN3et3pSCt5yL2I4eLsxQyiSoV O2BpWHuZ7WSUhjDeAunGihy+88njfObXkAqMTAwSxRZuK9axUrwdxYaF6CJAPN1fMQoU NZqQ== 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-Google-Smtp-Source: AA6agR7SW4X/z2/KBRG2HktprjmJVloGX+MBqKHPBlGemzTb4im9VSKYCCqeKOwXgfY6HGlNqFIMlw== 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 From: Marc =?iso-8859-1?Q?Poulhi=E8s?= To: gcc-patches@gcc.gnu.org Cc: Steve Baird Subject: [Ada] Internal error compiling formal instance of generic with Initial_Condition Message-ID: <20220912081931.GA1512981@poulhies-Precision-5550> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="5mCyUwZo2JvN/JJP" 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 List-Id: --5mCyUwZo2JvN/JJP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --5mCyUwZo2JvN/JJP Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="patch.diff" 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; --5mCyUwZo2JvN/JJP--