aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index a194360..f52103f 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;