From patchwork Tue Jan 9 13:15:59 2024 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: 186383 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp104662dyi; Tue, 9 Jan 2024 05:26:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCVESHZ3wTGIOniqxITjPfVQPVN6A2+WHnLAsNPsSZOuouL3qmpo210SS7rXsHocsYSbRt X-Received: by 2002:ac8:7f0a:0:b0:429:8cec:d0de with SMTP id f10-20020ac87f0a000000b004298cecd0demr5410386qtk.4.1704806803161; Tue, 09 Jan 2024 05:26:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704806803; cv=pass; d=google.com; s=arc-20160816; b=LMBdMOR3XKHKGih066DrYBk/vfyEyqu4HqGzGgbOGyb2Jyg4ujgqTLtoXVeLOvfgY5 6Dx6v1dbcOxIaEoe20iSK74Y+5InodsaD2FzbPHThH4+VMEmSLe/qxEQRqHvkf9KRiQv o8gT97qJYGKTSprXuWzMI56oR/YkOtyTgZXxhEYQL9j5yGbKhIrO4Jz6PbiQC+lmrxRH plNwarsqSdYV2cZienub9HjgMwm9a+UggwlicwoilNd8Rjo16KOMA3CKN437nTTB9cA8 KsJhV9hp2bglzX2GVDuX9VBjUpnSO9awlrSV8zBppNGGt8PEaU88zsLocj+cRK5IVl/h +ORw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=anZ98OEwgvxjC+3S21LWMswNXcjmC9h5n5NmQBS7v3M=; fh=V3FUX71dhq7uYqp2NU3QsSvdKCASDvtMIqKaZekiAR8=; b=pS7fAvW2QXQ+S1NZqrZGwrTqkiODIX+iLOLGlb2yhwb7FuNm5JySeys5z4bqwsbQ4K MGSz7DHYQHCiV9SRVFhiMzqitdKWz2Sdw+N73kjV3aaBb8W/PlEp8M+vIRLotCC6SiHA mIrsDVUsVQNmPEBMDoADfyw+N/pf3MtX+0hwFndUDeYk7GpHYvFVMWfgyuIZDiDs/IwS kwvRXZO6xpfQrd2VagjDLgji9gABPql2JyMEshFxVonNdQjgD6BML+w627E9tUPjCifo Ql6RePu07fVXSurtlVzk+cStqYePI8XkbIpthqBnPGOG08NP5emTQtt4Ydvn7B6l23N+ GKgg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b="NJzR5yS/"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id c8-20020ac87d88000000b00429a7c6c51esi1017425qtd.246.2024.01.09.05.26.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:26:43 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b="NJzR5yS/"; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CFF283861033 for ; Tue, 9 Jan 2024 13:26:42 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id A6B1F3861003 for ; Tue, 9 Jan 2024 13:16:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A6B1F3861003 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 A6B1F3861003 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42e ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704806164; cv=none; b=pjOfBr9ACokzb0t/Scf9rTfhn3CC/055PaxZWRgBHLWIyRVjVqY3+Wpf6oowI39hTNq0wVNYK/ztmr77tCrV3wFdK4t10uvUWeKW/q+5KR2VleeT/WTYriwBogQodqPbzieVqcpjK3xIPz+au1jItasIiqeD2azrzRyIXO4sB1s= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704806164; c=relaxed/simple; bh=xbpxH9kFcYRveKXIwJDQMiCC1pcFY7Kzhtouff9vUPs=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=gA/lGOluBn0n/KT+lZasTPMxCjIEdRsAERts0OcJMpZBru3edY4dZuPuP3MkBEfL4cC8+g/nZaFZqBLlOEwoJwcdFIkQ5c0DSL5+29cYsearBFHJT1F/bNC2TAZaq49kIe+J1xThFnV+PhZ3NetTe87FBP1rnn80hfQ3G3v7oI4= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-33694bf8835so2653348f8f.3 for ; Tue, 09 Jan 2024 05:16:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1704806160; x=1705410960; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=anZ98OEwgvxjC+3S21LWMswNXcjmC9h5n5NmQBS7v3M=; b=NJzR5yS/rULgoULle1iiRWuaJ/fqzUC1hkleVClNCkLreRHLwL/ucRFV0Swh1GKkFJ laX0oi27DgpJ89xBi3v0/DoDYIgMsAVIeQX+ftdJKeeXSpz47hnUzx1kLiIWmokuM3Ut 6N/jhsxEzO8kILjuqskkL8NrxVbnDn3XyawrTbt77w/vytN9JGfwFlqlApb2CFp6P3dM zElQEOhwZdP1wpMVvuwdhyHemM460TGAAca/xgCTy2rCTUGm5LlADuYTm2X4EE4ULN4R uNPzlxV9nFVug07AwpGXAXFrZo+2dXTomP9crd2AWB5via+GafFWmAQOmtUs8kFG40ji Ewpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704806160; x=1705410960; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=anZ98OEwgvxjC+3S21LWMswNXcjmC9h5n5NmQBS7v3M=; b=UyWp9tvjHv3B/9wWXkx9SuMcIQgoOzYuYYZ3hJ+3Dfg4RMjSq1EzD3B+pqYfNTP38U 47atkBIfogFYaezRSQKOm7Q5tLCX/FKY8GP435E/jWA8TKFsR+C3KFvjtPbgjBhlXxsy T1dHe++/NUS1sZf/NISom2oZLRTVdxgO56+uBDcuKryb3KxIToEqv8G2cmtg4mbMohj1 ys+925d0JREfOESE5X1n2NP9zTCZ698ceIwbaPzh+epzaOid0Bz2MSH+TX+FBOz/A0ub XfhRQvcE2DrkwkoJ1+jA3RWZDFoE5lJxyRzk0+LbSB7RlBPcjES4m0uDFIot/E7x5vCK 2tDg== X-Gm-Message-State: AOJu0YwAQDqPHMr3d4qrXlRK2QHYwqK8o5//HdsV/ihtySA4b+4MtjI7 zegZbx9zIgBHI9rXjvq5z3iRjOTbelvhmmUezibiSOsXyQ== X-Received: by 2002:a5d:514c:0:b0:337:6eee:36b4 with SMTP id u12-20020a5d514c000000b003376eee36b4mr660846wrt.20.1704806160508; Tue, 09 Jan 2024 05:16:00 -0800 (PST) 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 f13-20020adff58d000000b00336d24b4847sm2358232wro.114.2024.01.09.05.15.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 05:16:00 -0800 (PST) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Viljar Indus Subject: [COMMITTED] ada: Do not count comparison of addresses as a modification Date: Tue, 9 Jan 2024 14:15:59 +0100 Message-ID: <20240109131559.744937-1-poulhies@adacore.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787619498565478383 X-GMAIL-MSGID: 1787619498565478383 From: Viljar Indus In some extended code we generate comparisons between the Addresses of some variables. This causes those variables to be considered modified. Whereas in this particular scenario the variables are just referenced. gcc/ada/ * sem_attr.adb: avoid marking a use of the Address attribute as a modification of its prefix. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sem_attr.adb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb index a194360a601..f52103f28dd 100644 --- a/gcc/ada/sem_attr.adb +++ b/gcc/ada/sem_attr.adb @@ -12133,9 +12133,13 @@ package body Sem_Attr is | Attribute_Code_Address => -- To be safe, assume that if the address of a variable is taken, - -- it may be modified via this address, so note modification. + -- it may be modified via this address, so note modification, + -- unless the address is compared directly, which should not be + -- considered a modification. - if Is_Variable (P) then + if Is_Variable (P) + and then Nkind (Parent (N)) not in N_Op_Compare + then Note_Possible_Modification (P, Sure => False); end if;