From 55153b7b4d19bbafadacd23e2b8cd1f21f1dcee1 Mon Sep 17 00:00:00 2001 From: Javier Miranda Date: Sat, 4 Apr 2020 14:21:40 -0400 Subject: [PATCH] [Ada] Crash in tagged type constructor with task components 2020-06-16 Javier Miranda gcc/ada/ * sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings): Code cleanup. --- gcc/ada/sem_prag.adb | 51 ++++---------------------------------------- 1 file changed, 4 insertions(+), 47 deletions(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 673954acb5b..f3f0affb0ca 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -10694,54 +10694,11 @@ package body Sem_Prag is Add_To_Config_Boolean_Restrictions (No_Elaboration_Code); end if; - -- Special processing for No_Tasking restriction + -- Special processing for No_Tasking restriction placed in + -- a configuration pragmas file. - elsif R_Id = No_Tasking then - - -- Handle global configuration pragmas - - if No (Cunit (Main_Unit)) then - Set_Global_No_Tasking; - - -- Handle package System, which may be loaded by rtsfind as - -- a consequence of loading some other run-time unit. - - else - declare - C_Node : constant Entity_Id := - Cunit (Current_Sem_Unit); - C_Ent : constant Entity_Id := - Cunit_Entity (Current_Sem_Unit); - Loc_Str : constant String := - Build_Location_String (Sloc (C_Ent)); - Ref_Str : constant String := "system.ads"; - Ref_Len : constant Positive := Ref_Str'Length; - - begin - pragma Assert (Loc_Str'First = 1); - pragma Assert (Loc_Str'First = Ref_Str'First); - - if Nkind (Unit (C_Node)) = N_Package_Declaration - and then Chars (C_Ent) = Name_System - - -- Handle child packages named foo-system.ads - - and then Loc_Str'Length > Ref_Str'Length - and then Loc_Str (Loc_Str'First .. Ref_Len) - = Ref_Str (Ref_Str'First .. Ref_Len) - - -- ... and ensure that package System has not - -- been previously loaded. Done to ensure that - -- the above checks do not have any corner case - -- (since they are performed without semantic - -- information). - - and then not RTU_Loaded (Rtsfind.System) - then - Set_Global_No_Tasking; - end if; - end; - end if; + elsif R_Id = No_Tasking and then No (Cunit (Main_Unit)) then + Set_Global_No_Tasking; end if; -- If this is a warning, then set the warning unless we already -- 2.30.2