From patchwork Tue May 17 08:27:59 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: 54089 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 F3C863857357 for ; Tue, 17 May 2022 08:56:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F3C863857357 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1652777796; bh=coJYsZQHHdkaxBZZuQKyQQEQuIJT17pqNJMzjWcXu6w=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=Jn02Eo9R5Jcqx08SNWaGZ4ULS8QeZnxN7SYjpKBO9mb73W32VTUVRvOe4pHvBhOEs x7gxEWGXr25GyB0bSJGizsYJ7AB5fMR6PQdYXPc9LZ9vmQtLwYUhO5Lx8TjdOq4jb8 Nmp1l2/ZNfnLvHm0tf9+ZZjFuJuVxa0rabiYqAbw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by sourceware.org (Postfix) with ESMTPS id 680333857432 for ; Tue, 17 May 2022 08:28:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 680333857432 Received: by mail-wm1-x335.google.com with SMTP id n6so2279609wms.0 for ; Tue, 17 May 2022 01:28:00 -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=coJYsZQHHdkaxBZZuQKyQQEQuIJT17pqNJMzjWcXu6w=; b=TMKor0tzO14AHZjgaXwmKBXYN7Ag6uUaRodhmEabmLLQUEygXgFZHoXFYZgyxjBGx3 gQevzieFKpb7zXxPWRe2nfULhL02Xv1buuUOKxkrRl8wvz7PLWp2Gc2GD+bLce3KG7b/ arSJdBSTw8LXPlFlc8BqNOA2vI3aszxTiqGTgFCWSVl1vkfMB4GNYGg1h+6ci3LIAP5w tlYqFHYoAmagn+t9H8LxhBtkC8J9lhysVkCSG2hZfLa0Ig1ZIuN0DjTigBpJOn+0+Vhw drbIjgGbLbV401zuwepmrmO5eOBKffgmENZroDlMePh15KbEqPHTAbAN8YcC8zgsKegC E7YQ== X-Gm-Message-State: AOAM532jL+nZlb8S7eWay69FkcHGubehtjBO1n96SxM84FoL+i3mjSwH YG5blEEZ7cGqZEWV6N8EveG7M+7iLqyKimHL X-Google-Smtp-Source: ABdhPJxY/idEleNj07glzf+A9C7cxXqr0MmfwKzzgiZbmP1lTjgGyxwyv8sTmSZFfVtryDgDPJiQPg== X-Received: by 2002:a05:600c:1f13:b0:396:fee5:ebcf with SMTP id bd19-20020a05600c1f1300b00396fee5ebcfmr10194710wmb.201.1652776080007; Tue, 17 May 2022 01:28:00 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id bd10-20020a05600c1f0a00b00394538d039esm1292276wmb.6.2022.05.17.01.27.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 May 2022 01:27:59 -0700 (PDT) Date: Tue, 17 May 2022 08:27:59 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Restore defensive guard in checks for volatile actuals Message-ID: <20220517082759.GA1092896@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.3 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" When flagging names of volatile objects occurring in actual parameters it is safer to guard against identifiers without entity. This is redundant (because earlier in the resolution of actual parameters we already guard against actuals with Any_Type), but perhaps such identifiers will become allowed in constructs like: Subprogram_Call (Actual => (declare X : Boolean := ... with Annotate (GNATprove, ...))); ^^^^^^^^^ which include an identifier that does not denote any entity. Code cleanup related to handling of volatile components; behaviour is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_res.adb (Flag_Effectively_Volatile_Objects): Restore redundant guard. diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb --- a/gcc/ada/sem_res.adb +++ b/gcc/ada/sem_res.adb @@ -3873,7 +3873,8 @@ package body Sem_Res is -- selector_name in selected_component or as a choice in -- component_association. - if Is_Object (Id) + if Present (Id) + and then Is_Object (Id) and then Ekind (Id) not in E_Component | E_Discriminant and then Is_Effectively_Volatile_For_Reading (Id) and then