From patchwork Mon Sep 15 13:01:16 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: 120277 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 D53633858C52 for ; Mon, 15 Sep 2025 13:33:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D53633858C52 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=U+oOZBd4 X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id D9EF5385AC27 for ; Mon, 15 Sep 2025 13:01:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D9EF5385AC27 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 D9EF5385AC27 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::329 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757941319; cv=none; b=nCVVGvVBxweNZvxr2w+LEQ30+SIBKJgVhCJ0rjDvJn7BYt+G/3Jo1McOglFY5CDZCxXsobuSBO0hBbVw7I59ai4IzwWwbYzTjkU3jDb9aCXGZ9+wNyvZVRwfVUZ9wfoSrMTmhvxeEwoXuIddRx6mgvS/1umYMMZYXJhsJHDXoxs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1757941319; c=relaxed/simple; bh=pGb4+kxggn2Q+uIwvJbwChYJbHDKFgjiaNTD99wydP4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=E/hVXCkiVu8aFHeD/g0vsrOSQ9mrrlnZzg95oRh7zb124bzFLi0ZL6m3criJpnqL6PXGzLx6NPgpU41+ymt3mZa8eMBwrhIdc1C2pW95qM659XSTBMHTjcxvrkJbM4H7IQnuhszLUbLiaRpyh86NTVGIN6p/aRBhg+LzIbHMfz4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D9EF5385AC27 Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-45b9c35bc0aso37492805e9.2 for ; Mon, 15 Sep 2025 06:01:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1757941317; x=1758546117; 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=QH7tTP8nx6fUrixKBqhS12Cfw2YrQPqI3/TJ1WU03Ro=; b=U+oOZBd4zTEk6nkJt+wK5fBMoURjdPZqZOrj3FWYXWKZ7+j3GLufBh8GIbY3I8NuX4 TbugP6AGACoF+Tw8+ueR4xsy/OmE4e78aFRciB0GdwFG/gS1Pbyi0mxc6SQxlV8zEzKV eIBstg3iBtWjBEKAqpMCHhOacc/iRcbBHopGbMm0G1i+MEYQLzqCNxD3w+wYZJ01/ZEV frDkGQLQcwiUZwZ96dnxji7cIbes8Ohxrn3EjAPbjV3aEr5m7qWmBUaC1wHO6Qgpafeo vdTpZn28L8iY4bWNO0e7Nu2SSRRuUdat63UofynG8fU6rlqo8KJd6HeX6nYJ/RxmMKZ9 KArA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1757941317; x=1758546117; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message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Google-Smtp-Source: AGHT+IET/I9DUuL9hk6LZ6L1MNhMTwCvxmSds7qTuxYeryawLet3xldLziNuDg6LgPSG4PJ+BkTxrA== X-Received: by 2002:a05:600c:350f:b0:45f:2d21:cb36 with SMTP id 5b1f17b1804b1-45f2f2279e9mr16582355e9.35.1757941317395; Mon, 15 Sep 2025 06:01:57 -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.01.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Sep 2025 06:01:56 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED 10/27] ada: Avoid ghost context check in early freeze Date: Mon, 15 Sep 2025 15:01:16 +0200 Message-ID: <20250915130135.2720894-10-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 We freeze the expression for expression functions that complete before we have set up the ghost region from both the existing spec and body. Avoid triggering the ghost context checks during the analysis for this early freeze as the expression will be reanalyzed when we analyze the new function body created for the expression function. gcc/ada/ChangeLog: * sem_ch6.adb (Analyze_Expression_Function): Disable ghost checks during the early freeze. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_ch6.adb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 9042b3378ce7..4e5ede6b429e 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -436,11 +436,20 @@ package body Sem_Ch6 is Set_Parent (New_Body, Parent (N)); + -- Disable Ghost checks for this early analysis on the expression. + -- We have not analyzed the new body of the expression function + -- yet so the ghost region is not set up properly for the ghost + -- context checks yet. Avoid the checks for now as the expression + -- will be re-analyzed when the expression function is replaced + -- with the function body. + + Ghost_Context_Checks_Disabled := True; Freeze_Expr_Types (Def_Id => Def_Id, Typ => Typ, Expr => Expr, N => N); + Ghost_Context_Checks_Disabled := False; end if; -- For navigation purposes, indicate that the function is a body