From patchwork Tue Jul 5 08:30:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 1652360 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=de+KVpYW; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from 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 RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4Lcbk057HTz9s1l for ; Tue, 5 Jul 2022 18:41:11 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 01A7F3834E71 for ; Tue, 5 Jul 2022 08:41:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 01A7F3834E71 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1657010469; bh=6EmQ7NC+mmPMaN5SlPEL8CpfE2LXG2oTxSyuFSJeTzE=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=de+KVpYWMOPMsGCu+AgxGbcAThco1kbI4Nd8V6KxqX56vlfwjDiCCS0uCYah0CA3S 7yOtvlVD/TfxMV6y91facUY5i9nyYGSF5S9Bq5keBXEY2w2zmOXz1FKvOW5aHVeosG Y6aQfSLfllDTdhASvBepl2y0J51qlUPDRZ3215mg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by sourceware.org (Postfix) with ESMTPS id 5ED23385AE4F for ; Tue, 5 Jul 2022 08:30:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5ED23385AE4F Received: by mail-wr1-x431.google.com with SMTP id o4so16448618wrh.3 for ; Tue, 05 Jul 2022 01:30:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=6EmQ7NC+mmPMaN5SlPEL8CpfE2LXG2oTxSyuFSJeTzE=; b=dp03e77y6HWykeHYf5uhPCo4FhHskyREs5NpQ7Rcg/vkhnqtdEc9vctYcXiXDAJH0I cFcI7qvtYAZyGiuMAtuUkXDLoA8rcY3GCTGfDVPXQdfWknHGWQoO2DWqUswY/6uh7mT8 t/PZq9O8frCbzTvXEV3mKgKpq3F9cFkRh5B+furZI2nd1wuAgykG4UUy9C60zPizlx0Z s9Sg8ccYRERhcSAL7C4IzNQ7Z/vEhjpDsGnb/jOZf3hzEp8gGhb7IdPO0wWRscMUzam1 hTF5DWwTJqZlgeHf7vy21XucAbiHBhS/8PE9ZbavPZfLLTRR58ctecdp83ye9/tJDuDI 6BIw== X-Gm-Message-State: AJIora+9iHNl0KP7QN1VoAou67l8I6qSFAXTdHp2q64s69q9uMqT0Ns5 5rOurA1FAofn7JdV7JQ4KeLqFz8YrgfGsQ== X-Google-Smtp-Source: AGRyM1v0vdHMcVkI5JwvR2GImTLOl9iXecovImKHfpUtrkBQkRkhNhla0N1UuNYIZi3gaX3s76cQBQ== X-Received: by 2002:adf:f38f:0:b0:21d:66b5:21c with SMTP id m15-20020adff38f000000b0021d66b5021cmr10697193wro.144.1657009810986; Tue, 05 Jul 2022 01:30:10 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id v15-20020a5d43cf000000b0021badf3cb26sm38494565wrr.63.2022.07.05.01.30.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Jul 2022 01:30:10 -0700 (PDT) Date: Tue, 5 Jul 2022 08:30:10 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Remove kludge for validity checks on Long_Float type Message-ID: <20220705083010.GA3198524@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.2 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Piotr Trojanek Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This patch reverts a fix for a spurious warning for validity checks on type Long_Float. This fix was dubious (as it was only affecting Long_Float and not Float) and apparently is no longer needed. Cleanup related to improved detection of uninitialised scalar objects. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_attr.adb (Note_Possible_Modification): Revert a special-case for validity checks on Long_Float type. * snames.ads-tmpl (Name_Attr_Long_Float): Remove name added exclusively for the mentioned fix. diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -11145,43 +11145,10 @@ package body Sem_Attr is => -- Note possible modification if we have a variable - if Is_Variable (P) then - declare - PN : constant Node_Id := Parent (N); - Nm : Node_Id; - - Note : Boolean := True; - -- Skip this for the case of Unrestricted_Access occurring - -- in the context of a Valid check, since this otherwise - -- leads to a missed warning (the Valid check does not - -- really modify!) If this case, Note will be reset to - -- False. - - -- Skip it as well if the type is an Access_To_Constant, - -- given that no use of the value can modify the prefix. - - begin - if Attr_Id = Attribute_Unrestricted_Access - and then Nkind (PN) = N_Function_Call - then - Nm := Name (PN); - - if Nkind (Nm) = N_Expanded_Name - and then Chars (Nm) = Name_Valid - and then Nkind (Prefix (Nm)) = N_Identifier - and then Chars (Prefix (Nm)) = Name_Attr_Long_Float - then - Note := False; - end if; - - elsif Is_Access_Constant (Typ) then - Note := False; - end if; - - if Note then - Note_Possible_Modification (P, Sure => False); - end if; - end; + if Is_Variable (P) + and then not Is_Access_Constant (Typ) + then + Note_Possible_Modification (P, Sure => False); end if; -- Case where prefix is an entity name diff --git a/gcc/ada/snames.ads-tmpl b/gcc/ada/snames.ads-tmpl --- a/gcc/ada/snames.ads-tmpl +++ b/gcc/ada/snames.ads-tmpl @@ -776,7 +776,6 @@ package Snames is Name_Allow : constant Name_Id := N + $; Name_Amount : constant Name_Id := N + $; Name_As_Is : constant Name_Id := N + $; - Name_Attr_Long_Float : constant Name_Id := N + $; Name_Assertion : constant Name_Id := N + $; Name_Assertions : constant Name_Id := N + $; Name_Attribute_Name : constant Name_Id := N + $;