aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Schonberg <schonberg@adacore.com>2019-08-14 09:52:39 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-14 09:52:39 +0000
commit022c9dfe1f92a51da29a70a95b7af2f0541b6ab0 (patch)
treec76e8d51ba35da7c5dc2414e119d46d00077690a
parent0246fe44ac945c563cb57fdb625746293d8f8334 (diff)
downloadgcc-022c9dfe1f92a51da29a70a95b7af2f0541b6ab0.zip
gcc-022c9dfe1f92a51da29a70a95b7af2f0541b6ab0.tar.gz
gcc-022c9dfe1f92a51da29a70a95b7af2f0541b6ab0.tar.bz2
[Ada] Do not crash with -gnatR3 on Ghost aspects
2019-08-14 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_aux.adb (Next_Rep_Item): If a node in the rep chain involves a Ghost aspect it may have been replaced by a null statement; use the original node to find next Rep_Item. * repinfo.adb (List_Entities): Do not list an Ignored Ghost_Entity, for which information may have been deleted. From-SVN: r274470
-rw-r--r--gcc/ada/ChangeLog8
-rw-r--r--gcc/ada/repinfo.adb1
-rw-r--r--gcc/ada/sem_aux.adb6
3 files changed, 15 insertions, 0 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 370d943..1c869e1 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,11 @@
+2019-08-14 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_aux.adb (Next_Rep_Item): If a node in the rep chain
+ involves a Ghost aspect it may have been replaced by a null
+ statement; use the original node to find next Rep_Item.
+ * repinfo.adb (List_Entities): Do not list an Ignored
+ Ghost_Entity, for which information may have been deleted.
+
2019-08-14 Bob Duff <duff@adacore.com>
* sem_prag.ads, sem_prag.adb
diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb
index d168e90..6f531b2 100644
--- a/gcc/ada/repinfo.adb
+++ b/gcc/ada/repinfo.adb
@@ -479,6 +479,7 @@ package body Repinfo is
if Present (Ent)
and then Nkind (Declaration_Node (Ent)) not in N_Renaming_Declaration
+ and then not Is_Ignored_Ghost_Entity (Ent)
then
-- If entity is a subprogram and we are listing mechanisms,
-- then we need to list mechanisms for this entity. We skip this
diff --git a/gcc/ada/sem_aux.adb b/gcc/ada/sem_aux.adb
index 71a3873..e5bd68a 100644
--- a/gcc/ada/sem_aux.adb
+++ b/gcc/ada/sem_aux.adb
@@ -569,6 +569,12 @@ package body Sem_Aux is
elsif Entity (N) = E then
return N;
end if;
+
+ -- A Ghost-related aspect, if disabled, may have been replaced by a
+ -- null statement.
+
+ elsif Nkind (N) = N_Null_Statement then
+ N := Original_Node (N);
end if;
Next_Rep_Item (N);