From patchwork Thu Aug 1 15:17:28 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: 1967869 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=QTOxhjWk; 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 4WZYD01s77z1ybV for ; Fri, 2 Aug 2024 01:44:00 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E4E12384AB67 for ; Thu, 1 Aug 2024 15:43:57 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by sourceware.org (Postfix) with ESMTPS id 10E0F386102D for ; Thu, 1 Aug 2024 15:18:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 10E0F386102D 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 10E0F386102D Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::232 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722525525; cv=none; b=X6Q0fRcsqCjEqpB04JX2Dpszo6PXPHek+AoDVAYfiJ+mgfQnwfFfK8AiniRyZBM8iYnVOHHJN27chxhjLzjalVFoorfSQ6uAYP9DgqQ3l0AVUAmDf8f7Gnke8Ib8l7IdXkNKkqj8KFScNFKlNYLVYEuOoUszSi3LIzZ/QnMlJpw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1722525525; c=relaxed/simple; bh=adHY36GXP/dKwi6zjhcczGuvNZEI7uc74Zp/wABv4qw=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=fVzPgxWW7Q1O1ue0IPRoouh9hH4FQeqUI0O01UPkAcHmJ7FAtrOaQvtDIBzJyplRcMUE5ooLv1mRcdklTumpYqCqhA6RRjSYrzRqjzBH8oa7lsdYY4qp4mM2wUaueGo2SCpKxsjDN3YkcmmXJbZ1TnkTMFbtEnomi1pJ1aN/zBc= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lj1-x232.google.com with SMTP id 38308e7fff4ca-2f035ae0fe0so82673561fa.3 for ; Thu, 01 Aug 2024 08:18:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1722525506; x=1723130306; 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=bk95nOA3j84b88bNM2e+NEXmPsznD57WTmyiHLpBIUo=; b=QTOxhjWkF1d0WFr03+PbnJeK/9/2GCfJH+Mq73eKOujM0d5K4QwrbRrVm77jHzsZvy NfgoNeIXKPuOxlQhl/gclU+cPddxHl6RFrUQt2bndJFYKPTVYgrOIMkkctW/TIG7wy6W WfjPWrHds2WtDa6IHmu82xmYmucSkoGquaOZXUFJku3LWE9wEotatYsKbo8109YoiJaa EJVNJN/lAa+zVFFMkLvvcJ0y55NBNt/YkLeyY5N9jo83x253kATypjrXhDuLIUjUMoMl /4o8ZvGUYYmjJ55A5Dt6BXUvWz80qc2XuQaEtX2jXyd7XBIfUX1FycN3sSvTZPwLVDmi XzjA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722525506; x=1723130306; 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=bk95nOA3j84b88bNM2e+NEXmPsznD57WTmyiHLpBIUo=; b=TLhi2xYzfrG6v+HewaN+raW7+y8Dxw1CUvspFDwMN9D00V8RRn25XOVIlwg7OmLIzl QO8IL0ay50TIkR1h5Ja39VyoPJ4gLTNkgHxPdqPN+V9WCBKYe+NKLt34ksOBrpc+2TlJ +vX4LzH37U1kuUrXsGqRhOitpxrZM9fowqZbuGotQeoi2l2hqtr8xmuFhYP4XlkOFFiR uAGKYlrV4OfN8rDM3SpLBGKT59hK3L8TqL6mshqD/LaxqHyLpes65ARLGkgfi/LkpPY4 0kOEikO4CV8c0ge6F56uJdS8xBwZTVCuPbuiE+zou/NMY6jm9NKptJFF+Qs8gykHdGDv BMag== X-Gm-Message-State: AOJu0Yxtnas06qA3qJKgLSABpt/GLhMMAdNDHMgWlPpRtOndnyftGWSU bNmG+VA9zla4ZkzCd0qHdQrbhGYNd3fgKfKScVahtcXcsciDd+OBlWs8vqw1C8a456Odw+63DyQ Ymw== X-Google-Smtp-Source: AGHT+IGumrBYd9JnfyuUmy4uq9iMLplIx5t76bp7viloeCL9W3NSpbnQ+deBtCwFvd5YrQQOlQ6kpw== X-Received: by 2002:a2e:90ca:0:b0:2ef:18a2:9deb with SMTP id 38308e7fff4ca-2f15aa95c5emr4118011fa.16.1722525506412; Thu, 01 Aug 2024 08:18:26 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:b6aa:4751:9ea1:da1e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36b36857fdesm20065995f8f.75.2024.08.01.08.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Aug 2024 08:18:25 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Bob Duff Subject: [COMMITTED 20/30] ada: Fix bug in resolution of Ghost_Predicate Date: Thu, 1 Aug 2024 17:17:28 +0200 Message-ID: <20240801151738.400796-20-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240801151738.400796-1-poulhies@adacore.com> References: <20240801151738.400796-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: Bob Duff This patch fixes a failure of name resolution when a range attribute reference appears in a Ghost_Predicate and the ghost policy is Ignore. gcc/ada/ * sem_ch13.adb (Add_Predicate): Remove the premature "return;". Ghost code needs to be processed by later code in this procedure even when ignored; otherwise the second pass of name resolution fails much later. However, protect Set_SCO_Pragma_Enabled and Add_Condition with "if not Is_Ignored_Ghost_Pragma"; these parts should not happen if the ghost code is Ignored. * libgnat/interfac__2020.ads (Unsigned_8): Minor reformatting. * libgnat/interfac.ads (IEEE_Extended_Float): Minor comment improvement. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/libgnat/interfac.ads | 2 +- gcc/ada/libgnat/interfac__2020.ads | 1 + gcc/ada/sem_ch13.adb | 12 +++++++----- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/gcc/ada/libgnat/interfac.ads b/gcc/ada/libgnat/interfac.ads index b57264deb26..fe130d016ba 100644 --- a/gcc/ada/libgnat/interfac.ads +++ b/gcc/ada/libgnat/interfac.ads @@ -62,7 +62,7 @@ is -- such as SPARK or CodePeer. In the normal case Long_Long_Integer is -- always 64-bits so we get the desired 64-bit type. - type Unsigned_8 is mod 2 ** 8; + type Unsigned_8 is mod 2 ** 8; for Unsigned_8'Size use 8; type Unsigned_16 is mod 2 ** 16; diff --git a/gcc/ada/libgnat/interfac__2020.ads b/gcc/ada/libgnat/interfac__2020.ads index 0b5cc7d4339..cb20f34b0d7 100644 --- a/gcc/ada/libgnat/interfac__2020.ads +++ b/gcc/ada/libgnat/interfac__2020.ads @@ -227,6 +227,7 @@ is -- Note: it is harmless, and explicitly permitted, to include additional -- types in interfaces, so it is not wrong to have IEEE_Extended_Float -- defined even if the extended format is not available. + -- See RM-B.2(11). type IEEE_Extended_Float is new Long_Long_Float; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index b903381e5de..171e516bf3d 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -10218,12 +10218,12 @@ package body Sem_Ch13 is if Is_Ignored_Ghost_Pragma (Prag) then Add_Condition (New_Occurrence_Of (Standard_True, Sloc (Prag))); - return; - end if; - -- Mark corresponding SCO as enabled + else + -- Mark corresponding SCO as enabled - Set_SCO_Pragma_Enabled (Sloc (Prag)); + Set_SCO_Pragma_Enabled (Sloc (Prag)); + end if; -- Extract the arguments of the pragma @@ -10257,7 +10257,9 @@ package body Sem_Ch13 is -- "and"-in the Arg2 condition to evolving expression - Add_Condition (Arg2_Copy); + if not Is_Ignored_Ghost_Pragma (Prag) then + Add_Condition (Arg2_Copy); + end if; end; end if; end Add_Predicate;