From dc88759c874104bbf96cb56e44f2ea319541324a Mon Sep 17 00:00:00 2001 From: Javier Miranda Date: Tue, 21 Aug 2018 14:47:05 +0000 Subject: [PATCH] [Ada] Crash compiling SPARK ghost functions with callgraph info The compiler blows up generating the callgraph output of SPARK ghost subprograms whose contracts invoke ghost functions. 2018-08-21 Javier Miranda gcc/ada/ * exp_cg.adb (Generate_CG_Output): Handle calls removed by the expander. From-SVN: r263722 --- gcc/ada/ChangeLog | 5 +++++ gcc/ada/exp_cg.adb | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index dee70642a42..e9e674b8a14 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2018-08-21 Javier Miranda + + * exp_cg.adb (Generate_CG_Output): Handle calls removed by the + expander. + 2018-08-21 Ed Schonberg * layout.adb: Do not set size of access subprogram if unnesting. diff --git a/gcc/ada/exp_cg.adb b/gcc/ada/exp_cg.adb index 00f029b10fd..f40dc7e9c2a 100644 --- a/gcc/ada/exp_cg.adb +++ b/gcc/ada/exp_cg.adb @@ -121,7 +121,14 @@ package body Exp_CG is for J in Call_Graph_Nodes.First .. Call_Graph_Nodes.Last loop N := Call_Graph_Nodes.Table (J); - if Nkind (N) in N_Subprogram_Call then + -- No action needed for subprogram calls removed by the expander + -- (for example, calls to ignored ghost entities). + + if Nkind (N) = N_Null_Statement then + pragma Assert (Nkind (Original_Node (N)) in N_Subprogram_Call); + null; + + elsif Nkind (N) in N_Subprogram_Call then Write_Call_Info (N); else pragma Assert (Nkind (N) = N_Defining_Identifier); -- 2.30.2