From patchwork Fri Jun 21 08:58:06 2024 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: 1950636 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=Dw7jIfdQ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W5BCt4tVtz20X8 for ; Fri, 21 Jun 2024 19:00:58 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E293238A102D for ; Fri, 21 Jun 2024 09:00:56 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by sourceware.org (Postfix) with ESMTPS id 07EB23896C0D for ; Fri, 21 Jun 2024 08:58:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 07EB23896C0D Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 07EB23896C0D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718960321; cv=none; b=GUa1Fj+JYQ9hFK6qnEhDaJqDx2t7/jRmTAZtHcuedb63swwT5ghYfrV8BZtnMGHyQ1kmxRQuZFVFyJsSWqdm7VWcIh2wE6VGX3v7fDdRCnBqoYKAwg1um5pD5p0ay/E2NSZxDjAhYIIGFWg99X6oi0O6TMdsx/NuZETBejIRmZU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718960321; c=relaxed/simple; bh=dPMKyTKH0MNxgRxG7p5Gd+UZ0utsoc9lAL9gbz1Px+o=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=e0kpViHJA6ARkzNyQ/VClVNysdJJmDdS1HgZPUHhvjyoD/vYBxWeT5ZUUCizkxslxCBtjZ87t7+pPqjrZf1yFSDHXynXYBjIvXN9x1WTPV08bMv+2mGGGvhPg693LvlvPzhPPMMD7eEurZuY2PH5Evab8vwtmm4UQHIMCRgOfPg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-421cd1e5f93so13279165e9.0 for ; Fri, 21 Jun 2024 01:58:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718960318; x=1719565118; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QGytLC0gxjX2tyK69L3NkK3GNZIefgufoT979hYRleI=; b=Dw7jIfdQJBVLnrdDAcOat9UKVfeVTwuboxz7YadxbsJPiXbKw1M5RtVV52VlopmujM sdmjNCTk12G92/gZDrSzmybnHkoCLEvlgwlwDc9XWFOZt+28LWPF9T1rTnQc8IsKurL0 6iOqPzZ8ZsFQUS4U3cVGiybljmbqlqxRAqZX901ws2u0Ghpf4ZEjcCibFWHZO2POaCOF B9NfM3hcCbKTFR9BMKQCWudedsVl6bAchGSDBQ1XsOiTwJatkfDxrT5lCMt429tf4HZM s+ZdYumDKDeCoGI4hQfLNTZD/DncsAjSsOOs9EMcEI1BzgpH72ev6U2zK5PaHJIoiCWJ 2lUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718960318; x=1719565118; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QGytLC0gxjX2tyK69L3NkK3GNZIefgufoT979hYRleI=; b=GLR86zvstbJ02Cu4yQXEB9wucRJciHvbNuubOVOy41m69eWqOXHcAuDYDmMAZc2KWu HqG+qAS/1ny3drbdRFiPX0i9P6V+RQNzJNWiP/oBiTWSyH02MyLqZLByhoGstld/TKCI GpiCq//wdpvDBjhsBxyVG1RexVjv4wIZFTV6LLYRgRRteva/bZ/2Gjh/6t2B0EMuw0ly hxxszDzLCoFzg4uoVUuCaWylR+Kz+Z5IYMljANjeNJlpK/QQSLIm+xzpTvXMHqaacF0F o4NCD+EqAL+qI2bTHcsyEsGmLdCWrgUmlUs99xvIcWqI3TIB8DcJMF1CGlA8C73pfYn4 vuXg== X-Gm-Message-State: AOJu0YxaWDdTEJv6zzG50zJeXeGLASDcpvTLxSq84XtyFQ+uC6CAmCv0 RUzK1BJHy7uzOSLEF0FWlAx7YWKBsiJMiXeFq02Oltw09gR9Zz+sROirtw2u69Qkiy4woENClSE = X-Google-Smtp-Source: AGHT+IEm7mwhZKV+BYEEb2lS2daDASPoEoUnsX/ljtvrWQd8NS4FLYsYqbIaCmxwJV5c2FYSVT3Wmw== X-Received: by 2002:a05:600c:893:b0:422:6755:17e3 with SMTP id 5b1f17b1804b1-42475298eeamr58601585e9.29.1718960317872; Fri, 21 Jun 2024 01:58:37 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:a589:2704:bfe1:5d92]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4247d0c5485sm55322375e9.21.2024.06.21.01.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 01:58:37 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Javier Miranda Subject: [COMMITTED 10/22] ada: Cannot override inherited function with controlling result Date: Fri, 21 Jun 2024 10:58:06 +0200 Message-ID: <20240621085819.2485987-10-poulhies@adacore.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240621085819.2485987-1-poulhies@adacore.com> References: <20240621085819.2485987-1-poulhies@adacore.com> 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 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Javier Miranda When a package has the declaration of a derived tagged type T with private null extension that inherits a public function F with controlling result, and a derivation of T is declared in the public part of another package, overriding function F may be rejected by the compiler. gcc/ada/ * sem_disp.adb (Find_Hidden_Overridden_Primitive): Check public dispatching primitives of ancestors; previously, only immediately-visible primitives were checked. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_disp.adb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb index 9c498ee9a3f..fe822290e45 100644 --- a/gcc/ada/sem_disp.adb +++ b/gcc/ada/sem_disp.adb @@ -89,7 +89,9 @@ package body Sem_Disp is -- to the found entity; otherwise return Empty. -- -- This routine does not search for non-hidden primitives since they are - -- covered by the normal Ada 2005 rules. + -- covered by the normal Ada 2005 rules. Its name was motivated by an + -- intermediate version of AI05-0125 where this term was proposed to + -- name these entities in the RM. function Is_Inherited_Public_Operation (Op : Entity_Id) return Boolean; -- Check whether a primitive operation is inherited from an operation @@ -2403,7 +2405,7 @@ package body Sem_Disp is Orig_Prim := Original_Corresponding_Operation (Prim); if Orig_Prim /= Prim - and then Is_Immediately_Visible (Orig_Prim) + and then not Is_Hidden (Orig_Prim) then Vis_Ancestor := First_Elmt (Vis_List); while Present (Vis_Ancestor) loop