From patchwork Mon May 29 08:29:58 2023 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: 70241 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 912203947430 for ; Mon, 29 May 2023 08:40:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 912203947430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685349651; bh=P2P/Gg6BbxXpMdtbad//TCOrGW5dRDDnw5/aAHPeAP0=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=xXy55qlk/l1+TZwLGyO9ok8WNgqSVwz+s//Q5jHv2NBi5TSUnpD4fsWfCidp9fL0G lyZMyGCnW+QZivO5K/RYJpiK2LAQo2gNSgj/DlrISgpCVWmrNGuIPMP3V1H489P9FQ lDXTOBovnfKapPyN5ZCdOJdhCXJxm4dXc1POE8ss= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 6AD31384DA40 for ; Mon, 29 May 2023 08:30:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6AD31384DA40 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3f6e4554453so19542665e9.3 for ; Mon, 29 May 2023 01:30:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685349000; x=1687941000; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=P2P/Gg6BbxXpMdtbad//TCOrGW5dRDDnw5/aAHPeAP0=; b=lIeLu9bnz1q3X8JZgXTZDFXntHUiMPigxfizJonUH4mXSurr1qyWgnRw1zVmWeP9Nx nIEX9MtS+9lj7JbBCRruu/92od+9nN62j+oMIOsVVEBSMcYBa4k8dLZ9ZGnuyRbAH0hY Gw5H2vc7WY6WbsF6TfmsXmjtwi/Nzkfakjph/c87Zqvs130ME50wJ06/pRfkn0BTsRAB RIrKgarz+ZLvAV6Y2374G05J/u40aBK70FJSBLJLTjUMfDLFrseJxSpbb2Ia5qcnlWHh 7Pm76ViTNkYkUfJuffsoD44E+gAMKUBbMzieRnBPkqHYMeE37MkKGuCteMvor4au7u/Q B04Q== X-Gm-Message-State: AC+VfDzWaMdYt9ZKoh9C1d5v+UxKAwgedaSWAGkk75pA6NJU08QodeGr gfNHdG4Fi340tkxqV58uPjixAh/rxAb/1OuMywZYOQ== X-Google-Smtp-Source: ACHHUZ43m2C6Drz/uzsIo2hxT8n8lOdmpAgWB7U4zT7cRfAMROFfaSRAsWkhvXbJVbvj9I3tkGt+CQ== X-Received: by 2002:a7b:c448:0:b0:3f6:4cfc:79cb with SMTP id l8-20020a7bc448000000b003f64cfc79cbmr8130200wmi.31.1685349000219; Mon, 29 May 2023 01:30:00 -0700 (PDT) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id a2-20020adffb82000000b0030ae499da59sm6371376wrr.111.2023.05.29.01.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 May 2023 01:29:59 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix spurious error on imported generic function with precondition Date: Mon, 29 May 2023 10:29:58 +0200 Message-Id: <20230529082958.2411374-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.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: =?utf-8?q?Marc_Poulhi=C3=A8s?= Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" From: Eric Botcazou It occurs during the instantiation because the compiler forgets the context of the generic declaration. gcc/ada/ * freeze.adb (Wrap_Imported_Subprogram): Use Copy_Subprogram_Spec in both cases to copy the spec of the subprogram. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/freeze.adb | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 5d3413c1505..8ebf10bd576 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -6063,12 +6063,6 @@ package body Freeze is then -- Here we do the wrap - -- Note on calls to Copy_Separate_Tree. The trees we are copying - -- here are fully analyzed, but we definitely want fully syntactic - -- unanalyzed trees in the body we construct, so that the analysis - -- generates the right visibility, and that is exactly what the - -- calls to Copy_Separate_Tree give us. - Prag := Copy_Import_Pragma; -- Fix up spec so it is no longer imported and has convention Ada @@ -6127,7 +6121,7 @@ package body Freeze is Specification => Copy_Subprogram_Spec (Spec), Declarations => New_List ( Make_Subprogram_Declaration (Loc, - Specification => Copy_Separate_Tree (Spec)), + Specification => Copy_Subprogram_Spec (Spec)), Prag), Handled_Statement_Sequence => Make_Handled_Sequence_Of_Statements (Loc,