aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2022-06-07 11:00:56 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2022-07-05 08:28:19 +0000
commit95e2844ef8fa68f7abd45646bae8b4362614bf9c (patch)
treeaf091baf2c52c72fbc27dcaee2ee42ddec47dc6a /gcc
parentdba077902daf195da0e5bbac33a1f34bc6b20367 (diff)
downloadgcc-95e2844ef8fa68f7abd45646bae8b4362614bf9c.zip
gcc-95e2844ef8fa68f7abd45646bae8b4362614bf9c.tar.gz
gcc-95e2844ef8fa68f7abd45646bae8b4362614bf9c.tar.bz2
[Ada] Fix spurious error on object renaming with ghost type
Renaming of an object of ghost type leads to a spurious error. Now fixed. gcc/ada/ * ghost.adb (Is_OK_Ghost_Context): Detect ghost type inside object renaming.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ghost.adb11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb
index 25b9a28..8f23cbd 100644
--- a/gcc/ada/ghost.adb
+++ b/gcc/ada/ghost.adb
@@ -508,7 +508,16 @@ package body Ghost is
elsif Nkind (Parent (Par)) in N_Generic_Instantiation
| N_Renaming_Declaration
| N_Generic_Renaming_Declaration
- and then Par = Name (Parent (Par))
+ and then Par = Name (Parent (Par))
+ then
+ return True;
+
+ -- In the case of the renaming of a ghost object, the type
+ -- itself may be ghost.
+
+ elsif Nkind (Parent (Par)) = N_Object_Renaming_Declaration
+ and then (Par = Subtype_Mark (Parent (Par))
+ or else Par = Access_Definition (Parent (Par)))
then
return True;