aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJustin Squirek <squirek@adacore.com>2022-10-12 11:53:04 +0200
committerMarc Poulhiès <poulhies@adacore.com>2022-11-04 14:47:31 +0100
commit5f182787179e2503c01875759d0460d0f2936c8b (patch)
tree770f67d1b014f59a2c3fdff96f829ade2ba43a5a /gcc
parent4eac8834f9fb703ea04d3d3992a497182f4f86f0 (diff)
downloadgcc-5f182787179e2503c01875759d0460d0f2936c8b.zip
gcc-5f182787179e2503c01875759d0460d0f2936c8b.tar.gz
gcc-5f182787179e2503c01875759d0460d0f2936c8b.tar.bz2
ada: Fix for validity checks combined with aliasing checks
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.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/exp_attr.adb16
1 files changed, 11 insertions, 5 deletions
diff --git a/gcc/ada/exp_attr.adb b/gcc/ada/exp_attr.adb
index 3c3f725..1ef3065 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;