From: Arnaud Charlet Date: Sat, 23 May 2020 18:50:10 +0000 (+0200) Subject: [Ada] Crash in Walk_Library_Items on ghost units X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5f74065e26a7a795d480884f352d0aeb69b8f436;p=gcc.git [Ada] Crash in Walk_Library_Items on ghost units gcc/ada/ * sem.adb (Walk_Library_Items): Fix handling of Ghost units. --- diff --git a/gcc/ada/sem.adb b/gcc/ada/sem.adb index b84df652aa5..425dafa55d3 100644 --- a/gcc/ada/sem.adb +++ b/gcc/ada/sem.adb @@ -1848,12 +1848,16 @@ package body Sem is if Withed_Unit /= Main_CU and then not Done (Get_Cunit_Unit_Number (Withed_Unit)) then + -- N_Null_Statement will happen in case of a ghost unit + -- which gets rewritten. + if not Nkind_In (Unit (Withed_Unit), N_Generic_Package_Declaration, N_Package_Body, N_Package_Renaming_Declaration, - N_Subprogram_Body) + N_Subprogram_Body, + N_Null_Statement) then Write_Unit_Name (Unit_Name (Get_Cunit_Unit_Number (Withed_Unit)));