From patchwork Mon Sep 15 13:01:21 2025 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: 120275 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 7F7C8385782C for ; Mon, 15 Sep 2025 13:27:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F7C8385782C Authentication-Results: sourceware.org; dkim=pass (2048-bit key, secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=CvTQjbYR 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 EEDFE385B511 for ; Mon, 15 Sep 2025 13:02:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EEDFE385B511 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 EEDFE385B511 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::331 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757941324; cv=none; b=B8hBs3dgy+lnSks29S3mmIYIUXywWkiJfKomMjvHNHDVvBlzmBDfj1S03bJSnYFXq4/FLRdaIbRN275ejF/N40Cx1npP8A/DmjhlewNjbjsQu0hgMhTheFWxeBd9frXLd6MykZuK6v2j2MAG+W/rRhvHyWt7solNsVtrLqRe06c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757941324; c=relaxed/simple; bh=lWcli1BUqta3LbVennr7Jar4y8ZSOulTIgXcTEo9Ks0=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=qraMKGiBg4SQm2uLiO6o25k3mptoOFey5CUZEbY+n0HtP/mrvDDuTtFAAeDnX9KkdTEBHP1L4qyKmCVeAhhqod0rIByTJax59T9vEE/WCpqHV1FhJx0FoOlV2qkCngHn4FP2mi5EM2zlM3SLA6iqSqmfdmsEftXT2HoUcRs59W8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EEDFE385B511 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-45f2fbdacd2so3548215e9.3 for ; Mon, 15 Sep 2025 06:02:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1757941323; x=1758546123; 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=iGVgm5qTTVYk7BULdIellfaDR4MoanNEH1xeuKfS50s=; b=CvTQjbYRhgYnyi9t2nig61esYyOPF6SDOij/du63jdnsPe6BryCR/Ds+3JgvuvG2gt 6fjmEX5HLMq/1tF7vL4htY5LbHfQKX9yMx6DxZnCze1xTAJuinOq/8jgUG0WlgnsEulW 7LkCddHrPng34ZYLCZmgBDQHkeL8PQBtgcg85FlUmi/vNcNf0ehv7o8sKOBID6ckuGJO ZfL9unHqvT60iYwlfHQC4dlWf6M+p7n6f7DtAsWspmdFIdbysvUvusodnQPr1EsJlwBZ 3KscuItNIYfCRY+4WuPs2Jery9ILx6qq8fwPAjS95JrOqOufwsnbAroz2Jw9pbKjxqZh cofw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757941323; x=1758546123; 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=iGVgm5qTTVYk7BULdIellfaDR4MoanNEH1xeuKfS50s=; b=JbX0QZMch+tRZWP79tBkEnEvJHUW9LgolBcUJT+fEbEo4tYcRac7xmds/0Ic2mVNnX MOLsXLq0+/U+EwHWRT+DSyIoTro7R/mBUxwv23LXwKC6WtZMT7ZYn8tQbTGS6e27x7Ca wYd8M+4rtKsHFDqsdfJWuKTYKRJAZwusiJLZo4aV6E0TLvgxsVPmcML9o59xCApS7A5K wJevxRqX9oei1coTl7VGT28bExHBrBlPjLQGrZucgPX19JTJmJS2gnc985N5nhKWyx3n c4zdKL96SdhLJSjuZedgj6oYcN6XklyYeBWEsKr2uTQvpJFamkLsYyfKm3wgtIxnIIj4 3diA== X-Gm-Message-State: AOJu0YyoHpqbKffWh9W6SCzPw+NOSaO8BwD59qMKC2tDbMZRtVuRFUdz yAMWlTM1eWT0l8B1KdnFdxMiQNSdaSJWiqG7fKpl5GQmEmT8OpXxlNbewdpPi6rxRheprk89lmS H1GY= X-Gm-Gg: ASbGncvVdKS9JdECdTMTws1YSEO9xb6rDl3szEpvwkt437HBwqrk3Cihh9+5LajxpHv NFc2j+mPI8U1gKYr1DLdkA1NKkgf/jiOjha+5GvgIS1RbUirufNZhSwxAKhH94oDdcAO5zjOqeb YfrN9CQWC/pZIZw4LSiUshv3R8rfqoiVprP59YSbc4rhAFiDrvkWy6inHNMDn3jnOa1kWazS1aL 5adQ3bh6GWjNJwpI2HGw9XH/0QFpGfY8TbMmwj8q78Gxd1c3F75OoIWWbDiWj3qHZz6UljGAeN3 KeI583tRZCGACj8P1K7pddAOkwyMpyC1PYuD4+B/T5hkHuSO+Gge+qtELrcfsZo4JxZasitNq8/ 9SMkqdHpdhtn5kdLSX5l0kaNXUgjaxY6nCc145i9+WyuMDB4EFFkiieTaIItktI13GSe1TGOHnw jKoXHX0QHqqwjd/pixIFxu0matwqLA3ScxkArLfg== X-Google-Smtp-Source: AGHT+IHWCwYys2w8G97z2Moc8tFRk2yBvnG8FIVIM57XSBHqZnRer+Jk+s7zQvrYRwg0wJTMAj8w5g== X-Received: by 2002:a05:600c:1ca5:b0:456:1a69:94fd with SMTP id 5b1f17b1804b1-45f227746bbmr104092265e9.0.1757941322342; Mon, 15 Sep 2025 06:02:02 -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 ffacd0b85a97d-3ea4b52b7fcsm5428733f8f.33.2025.09.15.06.02.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Sep 2025 06:02:01 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 15/27] ada: Fix the condition of ghost level dependencies inside assignments Date: Mon, 15 Sep 2025 15:01:21 +0200 Message-ID: <20250915130135.2720894-15-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250915130135.2720894-1-poulhies@adacore.com> References: <20250915130135.2720894-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 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~patchwork=sourceware.org@gcc.gnu.org From: Viljar Indus The assignee should depend on the level of all of the ghost entiies with the assignment. gcc/ada/ChangeLog: * ghost.adb (Check_Assignee_Levels): Fix the condition and improve error message handling. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/ghost.adb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb index bfe6bff0751e..ef6315a7d3d5 100644 --- a/gcc/ada/ghost.adb +++ b/gcc/ada/ghost.adb @@ -561,22 +561,19 @@ package body Ghost is -- within an assignment statement whose target is a ghost -- variable that is assertion-level-dependent on E. - if not Is_Assertion_Level_Dependent (Id_Level, Assignee_Level) + if not Is_Assertion_Level_Dependent (Assignee_Level, Id_Level) then - Error_Msg_Sloc := Sloc (Ghost_Ref); - Error_Msg_N (Assertion_Level_Error_Msg, Ghost_Ref); Error_Msg_Name_1 := Chars (Id_Level); - Error_Msg_NE ("\& has assertion level %", Ghost_Ref, Id); + Error_Msg_N ("\& has assertion level %", Ghost_Ref); Error_Msg_Name_1 := Chars (Assignee_Level); Error_Msg_Node_2 := Assignee; - Error_Msg_NE - ("\& is modifying & with %", Ghost_Ref, Id); - Error_Msg_Name_1 := Chars (Assignee_Level); + Error_Msg_NE ("\& is modifying & with %", Ghost_Ref, Id); + Error_Msg_Name_1 := Chars (Id_Level); Error_Msg_NE ("\assertion level of & should depend on %", Ghost_Ref, - Id); + Assignee); end if; end Check_Assignment_Levels;