diff options
author | Viljar Indus <indus@adacore.com> | 2023-12-12 17:03:13 +0200 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-01-09 14:13:32 +0100 |
commit | 9b7d674fadd07aed242711e91232dbd049ef35be (patch) | |
tree | 2684fd14ab4513d86da0eeac04a62ee5d2b5ed68 /gcc | |
parent | 9f6266e0adfe2e6f941dfc090510b5bf9287502c (diff) | |
download | gcc-9b7d674fadd07aed242711e91232dbd049ef35be.zip gcc-9b7d674fadd07aed242711e91232dbd049ef35be.tar.gz gcc-9b7d674fadd07aed242711e91232dbd049ef35be.tar.bz2 |
ada: Do not count comparison of addresses as a modification
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_attr.adb | 8 |
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; |