Message ID | 20240829130750.1651060-5-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=cxrHUW5U; 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 4WvhSR3sCwz1yfy for <incoming@patchwork.ozlabs.org>; Thu, 29 Aug 2024 23:09:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 61E0A3850212 for <incoming@patchwork.ozlabs.org>; Thu, 29 Aug 2024 13:09:09 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id DE0B9385841E for <gcc-patches@gcc.gnu.org>; Thu, 29 Aug 2024 13:08:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DE0B9385841E 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 DE0B9385841E Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::432 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936892; cv=none; b=k9udiCP9cvowHfflAw6IOcs1dAPExuq9E9a9Oio7Ed0eucmeUsg64G1Rpkz6f+uPcP6KTWBKCbjANOCqEcx3oRyxFW2qNBWdty2kASEJ9Kt6c83gw7C7sEuGKsjMZUWLfJV4EcWxbhwu1XnMxhE5DG6x35U6BW5rr/IxpxdPD4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1724936892; c=relaxed/simple; bh=JArYAb3FVYlj1ZZB1kzhfLTWRPmhIrUi45I+A7mXwj4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Z0lxTEFIDpOoJtQQDhIL5yhnSOs0rtJ9bbGqu20775I4LTtoPFkBRkpfgAUyU4FVRzhPt+05bhU7O/mSVOLVinxQadog7Tr/VzSIj7pdy49CGp/E7smKrEY2Ro3cuLsCdrkpPfqMF1ObFzIBWbHPDfqrBwEj6uCgCBrvK4q2qwM= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x432.google.com with SMTP id ffacd0b85a97d-3718eaf4046so529710f8f.3 for <gcc-patches@gcc.gnu.org>; Thu, 29 Aug 2024 06:08:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1724936888; x=1725541688; 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=XVEEF8gKXKQ7uedqNj/kzNIjVbiJoi3xPG7UV+wmz9U=; b=cxrHUW5U/wk//OeHg9ls/GycGStX3dP+Qw/+VtACZn9d6CRglhneu0AMk5RcmoYKdh djE53fpeNa53a3p96WV0rOh9hdlrfdU6FaJWVsKQAPPgwzr4tUJXsJOyeeK5RP8SgbCp R7cnhp4KqfRpI4BVxoSwLRUTf/6+/L61zkgFbQy1J1U16mTR2ruBqAOFFaGYFFrtk8tF PghX7ZE96oauY7SHIpuJimhJHfl74QfSWf7od+kfzf/BPh1QPr2e1HjgWnECZV5tPixf 3gZ8wqLyr08Vkj85UOg9lT0kHQgImJbDqQC4z8AAMYyDHwmYQ4lPlR8a7MlTqz6zSZsy 7dIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724936888; x=1725541688; 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=XVEEF8gKXKQ7uedqNj/kzNIjVbiJoi3xPG7UV+wmz9U=; b=AwmdzkBFEZCqcMVBC5bCGjaf/HlCFjYBASHO15UY7witGtEXVa6Hu9L2FUw8d1d2+e +GNRug94AQfsGz8+4CbFAx4502SnEV/jPVjplpbrPclTN186J2R07npvNsa4OBJ2gHju 8XarVyZ5bUkaXVI0/SR9q32XjPqwu12ECNDpLGH78KvmBYX7YmgqpXtHPCLAn0N8ahd+ 5sEDvH8SGFE8nWKZDicvrtgpxXuAJWnazt0005eJJ7oNbNsfs1ybcaZuGqgdP3zckDgx Mb5es7rIW6O+fzdk7ApTggja6HdlmmafhwhD+qJsjkeSNeDZd0nikcXB+Mo1eVOl1hld awoA== X-Gm-Message-State: AOJu0YxwYPVWxe805X87TlJCGVS5/Aq5fEv0xAFelm4+4AfWRw+rFo8X kLcRX0nmniaQufwtq3HvdSWIE3FHpJenz284vnreSHwmf/LSQ6UTxF3VgCB38flwAQztOt/RW+s = X-Google-Smtp-Source: AGHT+IEoO3UjtlUCdqfcdgrKcchddg6fY2SoSU8Y+bFSzKcz8HxLsk8RjHnzTeQ0BsKsmIfP7Imz3Q== X-Received: by 2002:a05:6000:2ab:b0:371:8e24:1191 with SMTP id ffacd0b85a97d-3749b583df1mr3193618f8f.53.1724936887316; Thu, 29 Aug 2024 06:08:07 -0700 (PDT) Received: from poulhies-Precision-5550.lan ([2001:861:3382:1a90:5e2c:51b0:ac4a:92ca]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42bb6deb2f5sm17074605e9.2.2024.08.29.06.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 06:08:06 -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 05/17] ada: Ensure validity checks for private scalar types Date: Thu, 29 Aug 2024 15:07:35 +0200 Message-ID: <20240829130750.1651060-5-poulhies@adacore.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240829130750.1651060-1-poulhies@adacore.com> References: <20240829130750.1651060-1-poulhies@adacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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, T_SCC_BODY_TEXT_LINE 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/17] ada: Update documentation for conditional when constructs
|
expand
|
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb index 83879a519f7..2fb750c3ba4 100644 --- a/gcc/ada/checks.adb +++ b/gcc/ada/checks.adb @@ -6833,7 +6833,7 @@ package body Checks is ---------------------- function Expr_Known_Valid (Expr : Node_Id) return Boolean is - Typ : constant Entity_Id := Etype (Expr); + Typ : constant Entity_Id := Validated_View (Etype (Expr)); begin -- Non-scalar types are always considered valid, since they never give diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index bf04ea9d70a..4f6fa4cf6b7 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -10248,7 +10248,8 @@ package body Exp_Ch3 is if Nkind (Expr) = N_Unchecked_Type_Conversion and then Is_Scalar_Type (Under_Typ) then - Set_No_Truncation (Expr); + Set_Kill_Range_Check (Expr); + Set_No_Truncation (Expr); end if; return Expr;
From: Piotr Trojanek <trojanek@adacore.com> To check validity of data values, we must strip privacy from their types. gcc/ada/ * checks.adb (Expr_Known_Valid): Use Validated_View, which strips type derivation and privacy. * exp_ch3.adb (Simple_Init_Private_Type): Kill checks inside unchecked conversions, just like in Simple_Init_Scalar_Type. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/checks.adb | 2 +- gcc/ada/exp_ch3.adb | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-)