aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorYannick Moy <moy@adacore.com>2024-02-08 11:47:20 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-05-14 10:19:50 +0200
commit20dfaae2d1ba4749db13792105a32c5d8ef422e3 (patch)
treeb9f28328525bb5a31e75aeb263988e09be3d371e /gcc
parent324b3ffff7fa94b600d7b8d15108e2bdaf9f9ccc (diff)
downloadgcc-20dfaae2d1ba4749db13792105a32c5d8ef422e3.zip
gcc-20dfaae2d1ba4749db13792105a32c5d8ef422e3.tar.gz
gcc-20dfaae2d1ba4749db13792105a32c5d8ef422e3.tar.bz2
ada: Fix ghost policy in use for generic instantiation
The Ghost assertion policy relevant for analyzing a generic instantiation is the Ghost policy at the point of instantiation, not the one applicable for the generic itself. gcc/ada/ * ghost.adb (Mark_And_Set_Ghost_Instantiation): Fix the current Ghost policy for the instantiation.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ghost.adb14
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb
index 14951a0..6770890 100644
--- a/gcc/ada/ghost.adb
+++ b/gcc/ada/ghost.adb
@@ -1734,13 +1734,17 @@ package body Ghost is
elsif Ghost_Mode = Ignore then
Policy := Name_Ignore;
- -- Inherit the "ghostness" of the generic unit
+ -- Inherit the "ghostness" of the generic unit, but the current Ghost
+ -- policy is the relevant one for the instantiation.
- elsif Is_Checked_Ghost_Entity (Gen_Id) then
- Policy := Name_Check;
+ elsif Is_Checked_Ghost_Entity (Gen_Id)
+ or else Is_Ignored_Ghost_Entity (Gen_Id)
+ then
+ Policy := Policy_In_Effect (Name_Ghost);
- elsif Is_Ignored_Ghost_Entity (Gen_Id) then
- Policy := Name_Ignore;
+ if Policy = No_Name then
+ Policy := Name_Ignore;
+ end if;
end if;
-- Mark the instantiation as Ghost