public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1664] [Ada] Fix incorrect handling of Ghost aspect
@ 2022-07-13 10:03 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-07-13 10:03 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:8e3030ea9ae79880850c821887c9aa06a76ac21b
commit r13-1664-g8e3030ea9ae79880850c821887c9aa06a76ac21b
Author: Yannick Moy <moy@adacore.com>
Date: Tue Jul 5 12:51:25 2022 +0200
[Ada] Fix incorrect handling of Ghost aspect
When a formal generic type is marked as Ghost, the instantiation of that
generic will contain a generic subtype for the actual with the Ghost
pragma. Recognize this case.
gcc/ada/
* sem_prag.adb (Analyze_Pragma): Recognize a generated subtype
with Ghost pragma for generic instantiations.
Diff:
---
gcc/ada/sem_prag.adb | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index 982fdf811c6..df3d348b3a7 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -16999,6 +16999,16 @@ package body Sem_Prag is
then
Id := Defining_Entity (Stmt);
exit;
+
+ -- When pragma Ghost applies to a generic formal type, the
+ -- type declaration in the instantiation is a generated
+ -- subtype declaration.
+
+ elsif Nkind (Stmt) = N_Subtype_Declaration
+ and then Present (Generic_Parent_Type (Stmt))
+ then
+ Id := Defining_Entity (Stmt);
+ exit;
end if;
-- The pragma applies to a legal construct, stop the traversal
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-07-13 10:03 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13 10:03 [gcc r13-1664] [Ada] Fix incorrect handling of Ghost aspect Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).