Message ID | 20240517083207.130391-25-poulhies@adacore.com |
---|---|
State | New |
Headers | show
Return-Path: <gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org> 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=baska22l; 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 4VggRW5rT4z1ydW for <incoming@patchwork.ozlabs.org>; Fri, 17 May 2024 18:41:27 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1C216384AB7F for <incoming@patchwork.ozlabs.org>; Fri, 17 May 2024 08:41:26 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by sourceware.org (Postfix) with ESMTPS id E85913849AF3 for <gcc-patches@gcc.gnu.org>; Fri, 17 May 2024 08:32:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E85913849AF3 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 E85913849AF3 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::12b ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715934779; cv=none; b=dVUnsnJkMxcYgqeDjfsFE9iFlIuukcPkPnEqDqEFMiP/O3fJOau8q53A3YwEWqqOL2FOxoqtZChl6cHJygBPpV3X7kaRqXqjkzXlNXJ+k8/segeadA4iPDBhZIXgh3hC4Iw2jRrwxK26h51lQBrGbGakGCKa5EpQmeEgj6k/FF0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1715934779; c=relaxed/simple; bh=ctxY5mDFVKDjjc/w2c8J45SpSDeN9aGqsCaaD75Ok1U=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=C7YDPZbt6iGlL56yDgmjzHNWc8B4b3lTR1FPWVWLnj66FUiMRig4jXqb+wVEGHZFPVLTAGXw8Kq6Mc1YhIc4ZQ3hHyhhx6bjYXpzYP08kfR2falKizGVlhf61Vk5en4ydqOY9hX1r2D+2K15Lrr2luxnnGquEG3HFD9pvFENWIo= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-52232d0e5ceso452850e87.0 for <gcc-patches@gcc.gnu.org>; Fri, 17 May 2024 01:32:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1715934759; x=1716539559; 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=41ZDD7JlsCbKl4bUImpa/RNEFBtkTnOTJI1W9ZtpxuY=; b=baska22lxAgy755CohDIvYNi7Dm6//rup2Slk/BU8oNsvyI7eXPbx/vEFrBEbS1Qnk rKqF1J4Irle/m+OPrj9S6c6rfH3ERI/3qQuT2gpDdY4xn54MKU59oK6IToU0alUkcdOr boDdnXvMTJxMaH+vMWKuYikvB2CtLKquabchFQ0pyZhcDH099u6OqmpIhzWFGxG9KzWg ROJ3ht+Xaz6qAe3g2QjkP598pr3dcQXn+zfDOWdAP3+Vy5APo1WgnqKdlFx0BXdPJrET btqubhlGJZPM5FVgKdUjBEKh6YJviDclnkbIjBUhsTfjzgSGSdKgjBYG1ODmFUzB+xWK N67Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715934759; x=1716539559; 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=41ZDD7JlsCbKl4bUImpa/RNEFBtkTnOTJI1W9ZtpxuY=; b=AcZmhaSYUmDQJzNQRvx4t6S4zZErETyRGHYcOHB/v21STaS9+prpy3coeLuP7Tvoqq TRZT33N53izKOQrVPIy/iNgrLug006UphpQCx9qCUWzhJT4yEdzFoI5j7dvpZ7A5fFXa yk84PsDKm6FaoFfPCXp+uklUU8NXvskMsjQ7HsgEfhfwb+JQIKnYMb1BQqmSq4USYKJO NWeM7oFdRjiTLmCX6L9FHVvdo90jnEstOtOsmfn45WbcDEQbhpfPKS9o/9ilv9gPKaVz b8AAYFkKUTEKtB+band4JdIEMVTldr/xTkRG97hpvq9razyYqntRp4ETs4v1rrUnLfVA WHHw== X-Gm-Message-State: AOJu0YzljugqChYRt82wVJPkF99VUY4z23Fi1NdUCJ6/hVGzIQLbTy3p xoHdeRMJW3pbZOfpm0BFrqJPbt1my/2ft3UZAJWPUmy24rYeQfG9lWrO6gdjK0Km+gfhjjmlaro = X-Google-Smtp-Source: AGHT+IFVao7+bj/FDCcAVJjO9jmYkS5ki7+miQEfvOJ6TqQhriYVAiJsZNAuIhgNyojLqPmqnQkbYA== X-Received: by 2002:ac2:42c7:0:b0:51d:aa3a:4aac with SMTP id 2adb3069b0e04-5220fb7750bmr13143111e87.1.1715934759423; Fri, 17 May 2024 01:32:39 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:de37:8b1c:1f33:2610]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-420273cff03sm75197045e9.26.2024.05.17.01.32.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 01:32:38 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= <poulhies@adacore.com> To: gcc-patches@gcc.gnu.org Cc: Piotr Trojanek <trojanek@adacore.com> Subject: [COMMITTED 25/35] ada: Fix for validity checking and conditional evaluation of 'Old Date: Fri, 17 May 2024 10:31:57 +0200 Message-ID: <20240517083207.130391-25-poulhies@adacore.com> X-Mailer: git-send-email 2.43.2 In-Reply-To: <20240517083207.130391-1-poulhies@adacore.com> References: <20240517083207.130391-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.0 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 <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org |
Series |
[COMMITTED,01/35] ada: Add support for 'Object_Size to pragma Compile_Time_{Warning, Error}
|
expand
|
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index be777d26e46..d512d462b44 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -30791,6 +30791,14 @@ package body Sem_Util is return False; end if; + -- Handle constants introduced by side-effect + -- removal, e.g. by validity checks. + + if not Comes_From_Source (Obj) then + return + Is_Known_On_Entry (Expression (Parent (Obj))); + end if; + -- return False if not "all views are constant". if Is_Immutably_Limited_Type (Obj_Typ) or Needs_Finalization (Obj_Typ)
From: Piotr Trojanek <trojanek@adacore.com> Detection of expression that are "known on entry" (as defined in Ada 2022 RM 6.1.1(20/5)) was confused by validity checks when used from within expansion of attribute 'Old. gcc/ada/ * sem_util.adb (Is_Known_On_Entry): Handle constants introduced by validity checks. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_util.adb | 8 ++++++++ 1 file changed, 8 insertions(+)