From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 9FEB138555A4 for ; Fri, 4 Nov 2022 13:59:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9FEB138555A4 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wr1-x431.google.com with SMTP id h9so7239583wrt.0 for ; Fri, 04 Nov 2022 06:59:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kFnqlXmcLC1k/Khcr3eUBWnUARy1/gX2DxemlznSLPs=; b=glYdHZqHhm45GeHI6/HBXR5o4wldz6iGkHV2moGOaSidLP5Fi4aTK08iL+iNjW8+Pa QwHNDSNOGCynjhI6vnzrAuF59vEuyI3wbEDfM0qZdtHrwsxlmWyzPwfQ9y/XiuR//jV0 2x4XIGnFSqA+2FPSjb75HpyJC90Meq44s+QAneuOq3U5mZgUwH2+PctXJxwyjYV8CFDt H5GqBARQVXOp3NcQZMBP93njGfUv1Whee/QqReYiT9VjfGrCmQJJH4DkLdc/3k34HB4Z rgQKYsf47aaph3Jy33yZuU+Iy1m7wJU30d3rPA0tb4R0au4WMnn/h0biSOrY6SGV96Qt zNnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=kFnqlXmcLC1k/Khcr3eUBWnUARy1/gX2DxemlznSLPs=; b=sANyx2rsHyUwoiISjBXZBFTxOPpkM2dSmhtpZzN5E/ENTjuxZonB0Oywg3zWaN9Y8R 5gGz9ACKbOKcql48cE0MvQa9NqAIyhQgTJNdi3vLgpNGC+fazgWDCOdXi8LP0FKeHo29 vz9eKicwZ9taE0kATt/FFdBYEgtWqniyO6aB9TyP7tlJLUH8VT35CR3u3vvic0tXc3MR RbvoIlIXA04KGSrQzVcXXz+5WWMIFn3MWOi0R9POB/31XttijNtobVVLQf01zUrgscf6 SWUeCtzoXZ9eymj4jyukxT0In1vbhOYpp+Rf89n3I4RRdUifhzJU9Zk+zvFaA5njL343 QEpQ== X-Gm-Message-State: ACrzQf1ZWHxrjTOdhkuz/U1ryQkKFftn0/DCr3Me0sMClVBdmp2bp0Yx T719uLrt/UKRm55pCTPuI6nUw086KBun7Q== X-Google-Smtp-Source: AMsMyM63B3+5LWdNJXvKLDRLGY7Wo0wls8C5a4Eo2QHkc0JyhftnerxdhJUv7Sxcl7eWTLrouICZNg== X-Received: by 2002:adf:f7d2:0:b0:236:87bc:a8f7 with SMTP id a18-20020adff7d2000000b0023687bca8f7mr22501247wrq.579.1667570347220; Fri, 04 Nov 2022 06:59:07 -0700 (PDT) Received: from localhost.localdomain (static-176-191-105-132.ftth.abo.bbox.fr. [176.191.105.132]) by smtp.gmail.com with ESMTPSA id l11-20020a05600c1d0b00b003cf878c4468sm3359727wms.5.2022.11.04.06.59.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Nov 2022 06:59:06 -0700 (PDT) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Justin Squirek Subject: [COMMITTED] ada: Fix for validity checks combined with aliasing checks Date: Fri, 4 Nov 2022 14:59:03 +0100 Message-Id: <20221104135903.87298-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: From: Justin Squirek Attribute Overlaps_Storage, which can appear implicitly in expansion of aliasing checks, is now excluded from operand validity checks. Likewise for attribute Has_Same_Storage. gcc/ada/ * exp_attr.adb (Expand_N_Attribute_Reference): Skip operand validity checks for attributes Has_Same_Storage and Overlaps_Storage. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_attr.adb | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb index 3c3f725cf27..1ef30656496 100644 --- a/gcc/ada/exp_attr.adb +++ b/gcc/ada/exp_attr.adb @@ -1998,16 +1998,22 @@ package body Exp_Attr is -- Start of processing for Expand_N_Attribute_Reference begin - -- Do required validity checking, if enabled. Do not apply check to - -- output parameters of an Asm instruction, since the value of this - -- is not set till after the attribute has been elaborated, and do - -- not apply the check to the arguments of a 'Read or 'Input attribute - -- reference since the scalar argument is an OUT scalar. + -- Do required validity checking, if enabled. + -- + -- Skip check for output parameters of an Asm instruction (since their + -- valuesare not set till after the attribute has been elaborated), + -- for the arguments of a 'Read or 'Input attribute reference (since + -- the scalar argument is an OUT scalar) and for the arguments of a + -- 'Has_Same_Storage or 'Overlaps_Storage attribute reference (which not + -- considered to be reads of their prefixes and expressions, see Ada RM + -- 13.3(73.10/3)). if Validity_Checks_On and then Validity_Check_Operands and then Id /= Attribute_Asm_Output and then Id /= Attribute_Read and then Id /= Attribute_Input + and then Id /= Attribute_Has_Same_Storage + and then Id /= Attribute_Overlaps_Storage then declare Expr : Node_Id; -- 2.34.1