diff options
author | Justin Squirek <squirek@adacore.com> | 2024-02-12 15:50:24 +0000 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-05-14 10:19:53 +0200 |
commit | 416e572edb0cbc84081de5a1932be7a2138a529a (patch) | |
tree | 63d35c6c88bcbbc3a3ab3ac4e2dcd4b51ec0ca7a /gcc | |
parent | f545412378592e3c4b420b61867bfd3dda2f6480 (diff) | |
download | gcc-416e572edb0cbc84081de5a1932be7a2138a529a.zip gcc-416e572edb0cbc84081de5a1932be7a2138a529a.tar.gz gcc-416e572edb0cbc84081de5a1932be7a2138a529a.tar.bz2 |
ada: Spurious unreferenced warning on selected component
This patch fixes an error in the compiler whereby a selected component on the
left hand side of an assignment statement may not get marked as referenced -
leading to spurious unreferenced warnings on such objects.
gcc/ada/
* sem_util.adb (Set_Referenced_Modified): Use Original_Node to
avoid recursive calls on expanded / internal objects such that
source nodes get appropriately marked as referenced.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/sem_util.adb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index b5c3363..4e1258e 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -27625,7 +27625,11 @@ package body Sem_Util is -- Deal with indexed or selected component where prefix is modified if Nkind (N) in N_Indexed_Component | N_Selected_Component then - Pref := Prefix (N); + + -- Grab the original node to avoid looking at internally generated + -- objects. + + Pref := Original_Node (Prefix (N)); -- If prefix is access type, then it is the designated object that is -- being modified, which means we have no entity to set the flag on. |