From: pmderodat Date: Tue, 21 Aug 2018 14:47:05 +0000 (+0000) Subject: [Ada] Crash compiling SPARK ghost functions with callgraph info X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a85e94af9424e4ee1162a5314be4f2d2117d181f;p=thirdparty%2Fgcc.git [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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@263722 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index dee70642a427..e9e674b8a141 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 00f029b10fd3..f40dc7e9c2a7 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);