From 022c9dfe1f92a51da29a70a95b7af2f0541b6ab0 Mon Sep 17 00:00:00 2001 From: Ed Schonberg Date: Wed, 14 Aug 2019 09:52:39 +0000 Subject: [PATCH] [Ada] Do not crash with -gnatR3 on Ghost aspects 2019-08-14 Ed Schonberg 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 --- gcc/ada/ChangeLog | 8 ++++++++ gcc/ada/repinfo.adb | 1 + gcc/ada/sem_aux.adb | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 370d943a6df..1c869e12359 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2019-08-14 Ed Schonberg + + * 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 * sem_prag.ads, sem_prag.adb diff --git a/gcc/ada/repinfo.adb b/gcc/ada/repinfo.adb index d168e90e0a9..6f531b21348 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 71a38732763..e5bd68ac7b8 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); -- 2.30.2