From patchwork Mon May 15 09:43:53 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: 94046 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp6793333vqo; Mon, 15 May 2023 02:51:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6WzUQSQsCjVdhaPV9e1mnHl+on8O827JoUJihYrpcjPp4ZOe3uyCp7VSpM2iyYByyMD7MZ X-Received: by 2002:a05:6402:1819:b0:510:6217:9994 with SMTP id g25-20020a056402181900b0051062179994mr1736767edy.39.1684144279888; Mon, 15 May 2023 02:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684144279; cv=none; d=google.com; s=arc-20160816; b=UkdfxTH/MHrsyMBP/GouYj1XeAtNF5QJmQCW4mC9ziwigs/9dcwEzqdUPhz7hXlVXa Dfh9iSgH2shEWTis50V09CfDjBEcShLDYPeFUkm48Xa6Y5TkCjJDIOA99x9cd/P6Gy4q KrPI1aHQBYQvop6C0B0vBcZjom8hxd++MzqRpi77ZImmSxcF9wHpfzj6jaGdlf8Zr7l7 VOPOt7va1J7cvOK0GB9oH4FBngoCLyLNCaGOoXYxxWdbg+6epFFilvNi5ESoqZ6Z7i4u eZJTMQODqILcqe5d19svcunjasIADyosAY7r35x2TCr0LAJBkT62qZERL0A8n/oshTrD MzZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=vUY0dqGtHtYy6HeZNAVyoSVoLVQ81qgKkycG346drDE=; b=YXUGKStiNiKfHqEskpGj0hdM/62sfMk2Dj6xZGODni+pKhAqDwlcXMwokyQKaTLbe9 ddWCrkZ8pc91pXHno0BjCliBmJ3/S851y1/TyZKUqOIkv8/WGYDYJunB+rRHR5895xJ5 l3d8Ov7topblRrVXVlCjv9oducOR9yIh0fefsgwG3spHmPBQRJBwZUO03U8h54UjGlFO vqdNjQdT+ylB3oUF1pGKqASZeB6loaYXoO+9LmmO9Z7YdKxSS5Lyyt40UIVpXxVjVf2E Csshj5omrOvuzByKHW6Lm6v9pNIzVxiErKoS1urcxGNw+AZtD6biN3/hjn4YivlMrjQl sHvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=u+ewnEuH; 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 r7-20020aa7cfc7000000b0050508e6cf5asi11989223edy.79.2023.05.15.02.51.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 02:51:19 -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=u+ewnEuH; 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 0508538983AE for ; Mon, 15 May 2023 09:46:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0508538983AE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684144011; bh=vUY0dqGtHtYy6HeZNAVyoSVoLVQ81qgKkycG346drDE=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=u+ewnEuHOqRQsU3CFWr5L2bu358SFmLvGnLE8GmQVZN+hAJCDeC9a0gw6cPb9S+A2 whPeqmp0F3VAt64TPMWLY96BPZMuOy8bdszvW5FR0R6q0Uuum459YsPrKA5wHQkZ+a 1qf2o/Z0s8pXC5xXvy2QBYh/75i5IG/OPSQ135Zw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id 522D538708D0 for ; Mon, 15 May 2023 09:43:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 522D538708D0 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-3078c092056so6466066f8f.1 for ; Mon, 15 May 2023 02:43:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684143836; x=1686735836; 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=vUY0dqGtHtYy6HeZNAVyoSVoLVQ81qgKkycG346drDE=; b=H4RtdOsuaIP0ps/Bnv/0PGZ6RsMjyBUpPSJNWZYjfV/Jo1x9p5+Pgntn6KQPp/Jbpa GTo7O7zs+eFoOc5OaX8IxRAnxramPfhMelYqlijRCKgfCguR6ug+Gj4tTnQnrpkrTRtX omXXxo8zZxCUelm5f7wPGE8AgeR9W57I21Wu2ywk/jQ31z2gy0HQUdzFWpqVcAsaG8mm yHhrk9KUcWba2M1EAZEhcjRLQe44tLEIm95/enfHetTp9xheRz3vKSM7M4rv0hLuPZCK Lhy7jPZh8UI/EVqtXQbO4oW1T2Dmvjs12S8bfspX2ADLJ37RRLh8XACzlQ3cORuuww5g rgRg== X-Gm-Message-State: AC+VfDxmtWbS9Xa61LA0D4t/scVf3EFq/8qleqzCI9LZ4MsrwOnXdmEj FXkwUiYPT0pqbvWxilJB0ogsaS6/Xc6m/GAWAYCEdQ== X-Received: by 2002:a05:6000:1361:b0:306:37a2:6e56 with SMTP id q1-20020a056000136100b0030637a26e56mr21058170wrz.5.1684143836267; Mon, 15 May 2023 02:43:56 -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 14-20020a05600c230e00b003f4248dcfcbsm23280444wmo.30.2023.05.15.02.43.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 May 2023 02:43:55 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix internal error on instance in package body with -gnatn Date: Mon, 15 May 2023 11:43:53 +0200 Message-Id: <20230515094353.1408487-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.4 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765953272521309681?= X-GMAIL-MSGID: =?utf-8?q?1765953272521309681?= From: Eric Botcazou This plugs a small loophole in the procedure responsible for attempting to hide entities that have been previously made public by the semantic analyzer in package bodies. gcc/ada/ * sem_ch7.adb (Hide_Public_Entities): Use the same condition for subprogram bodies without specification as for those with one. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch7.adb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 7cb7c862d35..1f1fbd3c703 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -446,7 +446,11 @@ package body Sem_Ch7 is else Decl_Id := Defining_Entity (Decl); + -- See the N_Subprogram_Declaration case below + if not Set_Referencer_Of_Non_Subprograms + and then (not In_Nested_Instance + or else not Subprogram_Table.Get_First) and then not Subprogram_Table.Get (Decl_Id) then -- We can reset Is_Public right away