From b941ae6528c7f24d93a6f819ad2507727f3bd3ed Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 23 Jun 2010 09:29:04 +0000 Subject: [PATCH] exp_ch4.adb (Expand_N_Allocator): Fix potential crash when using No_Task_Hierarchy restriction. 2010-06-23 Arnaud Charlet * exp_ch4.adb (Expand_N_Allocator): Fix potential crash when using No_Task_Hierarchy restriction. Add comment. * exp_ch9.adb, exp_ch3.adb: Update comments. From-SVN: r161266 --- gcc/ada/ChangeLog | 6 ++++++ gcc/ada/exp_ch3.adb | 7 +++---- gcc/ada/exp_ch4.adb | 11 ++++++----- gcc/ada/exp_ch9.adb | 5 ++--- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 00e199bb02b..5af1505d8a2 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2010-06-23 Arnaud Charlet + + * exp_ch4.adb (Expand_N_Allocator): Fix potential crash when using + No_Task_Hierarchy restriction. Add comment. + * exp_ch9.adb, exp_ch3.adb: Update comments. + 2010-06-23 Robert Dewar * sem_ch5.adb (Process_Bounds): Remove some junk initializations. diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index 9326406c2a4..e2263f3ab8f 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -1465,8 +1465,8 @@ package body Exp_Ch3 is if Has_Task (Full_Type) then if Restriction_Active (No_Task_Hierarchy) then - -- See comments in System.Tasking.Initialization.Init_RTS - -- for the value 3 (should be rtsfindable constant ???) + -- 3 is System.Tasking.Library_Task_Level + -- (should be rtsfindable constant ???) Append_To (Args, Make_Integer_Literal (Loc, 3)); @@ -2020,8 +2020,7 @@ package body Exp_Ch3 is if Has_Task (Rec_Type) then if Restriction_Active (No_Task_Hierarchy) then - -- See comments in System.Tasking.Initialization.Init_RTS - -- for the value 3. + -- 3 is System.Tasking.Library_Task_Level Append_To (Args, Make_Integer_Literal (Loc, 3)); else diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 5cbcc398274..7588ae3cc03 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -3644,9 +3644,11 @@ package body Exp_Ch4 is -- The designated type was an incomplete type, and the -- access type did not get expanded. Salvage it now. - pragma Assert (Present (Parent (Base_Type (PtrT)))); - Expand_N_Full_Type_Declaration - (Parent (Base_Type (PtrT))); + if not Restriction_Active (No_Task_Hierarchy) then + pragma Assert (Present (Parent (Base_Type (PtrT)))); + Expand_N_Full_Type_Declaration + (Parent (Base_Type (PtrT))); + end if; end if; -- If the context of the allocator is a declaration or an @@ -3689,9 +3691,8 @@ package body Exp_Ch4 is Decls := Build_Task_Image_Decls (Loc, T, T); end if; - -- What is this constant 3 below, should have a name ??? - if Restriction_Active (No_Task_Hierarchy) then + -- 3 is System.Tasking.Library_Task_Level Append_To (Args, Make_Integer_Literal (Loc, 3)); else Append_To (Args, diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index 70d92266489..2aec546e91a 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -12121,9 +12121,8 @@ package body Exp_Ch9 is -- Master parameter. This is a reference to the _Master parameter of -- the initialization procedure, except in the case of the pragma - -- Restrictions (No_Task_Hierarchy) where the value is fixed to 3. - -- See comments in System.Tasking.Initialization.Init_RTS for the - -- value 3. + -- Restrictions (No_Task_Hierarchy) where the value is fixed to 3 + -- (3 is System.Tasking.Library_Task_Level). if Restriction_Active (No_Task_Hierarchy) = False then Append_To (Args, Make_Identifier (Loc, Name_uMaster)); -- 2.30.2