aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@adacore.com>2021-02-28 08:25:42 -0500
committerPierre-Marie de Rodat <derodat@adacore.com>2021-06-16 04:43:02 -0400
commit37cd8d97f3aa779197eb103d1e4b4d0ac63adc4a (patch)
tree2d80e2570e4c4e2ea7c448561ff38a1225f6ee42
parentf7f37ed649417925dee12e099dbb3227a3be30c2 (diff)
downloadgcc-37cd8d97f3aa779197eb103d1e4b4d0ac63adc4a.zip
gcc-37cd8d97f3aa779197eb103d1e4b4d0ac63adc4a.tar.gz
gcc-37cd8d97f3aa779197eb103d1e4b4d0ac63adc4a.tar.bz2
[Ada] Wrong reference to System.Tasking in expanded code
gcc/ada/ * rtsfind.ads, libgnarl/s-taskin.ads, exp_ch3.adb, exp_ch4.adb, exp_ch6.adb, exp_ch9.adb, sem_ch6.adb: Move master related entities to the expander directly.
-rw-r--r--gcc/ada/exp_ch3.adb9
-rw-r--r--gcc/ada/exp_ch4.adb4
-rw-r--r--gcc/ada/exp_ch6.adb2
-rw-r--r--gcc/ada/exp_ch9.adb39
-rw-r--r--gcc/ada/libgnarl/s-taskin.ads3
-rw-r--r--gcc/ada/rtsfind.ads16
-rw-r--r--gcc/ada/sem_ch6.adb2
7 files changed, 28 insertions, 47 deletions
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 4de75a6..23b5b34 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -1696,8 +1696,7 @@ package body Exp_Ch3 is
if Has_Task (Full_Type) then
if Restriction_Active (No_Task_Hierarchy) then
- Append_To (Args,
- New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc));
+ Append_To (Args, Make_Integer_Literal (Loc, Library_Task_Level));
else
Append_To (Args, Make_Identifier (Loc, Name_uMaster));
end if;
@@ -2218,8 +2217,8 @@ package body Exp_Ch3 is
if Has_Task (Rec_Type) then
if Restriction_Active (No_Task_Hierarchy) then
- Append_To (Args,
- New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc));
+ Append_To
+ (Args, Make_Integer_Literal (Loc, Library_Task_Level));
else
Append_To (Args, Make_Identifier (Loc, Name_uMaster));
end if;
@@ -9071,7 +9070,7 @@ package body Exp_Ch3 is
Defining_Identifier =>
Make_Defining_Identifier (Loc, Name_uMaster),
Parameter_Type =>
- New_Occurrence_Of (RTE (RE_Master_Id), Loc)));
+ New_Occurrence_Of (Standard_Integer, Loc)));
Set_Has_Master_Entity (Proc_Id);
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index 81f8387..5b3a116 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -5193,8 +5193,8 @@ package body Exp_Ch4 is
end if;
if Restriction_Active (No_Task_Hierarchy) then
- Append_To (Args,
- New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc));
+ Append_To
+ (Args, Make_Integer_Literal (Loc, Library_Task_Level));
else
Append_To (Args,
New_Occurrence_Of
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index 919e174..b5d77bd 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -602,7 +602,7 @@ package body Exp_Ch6 is
-- Use a dummy _master actual in case of No_Task_Hierarchy
if Restriction_Active (No_Task_Hierarchy) then
- Actual := New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc);
+ Actual := Make_Integer_Literal (Loc, Library_Task_Level);
-- In the case where we use the master associated with an access type,
-- the actual is an entity and requires an explicit reference.
diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb
index fa2d84d..3948b6a 100644
--- a/gcc/ada/exp_ch9.adb
+++ b/gcc/ada/exp_ch9.adb
@@ -1756,34 +1756,21 @@ package body Exp_Ch9 is
-- Generate a dummy master if tasks or tasking hierarchies are
-- prohibited.
- -- _Master : constant Master_Id := 3;
+ -- _Master : constant Integer := Library_Task_Level;
if not Tasking_Allowed
or else Restrictions.Set (No_Task_Hierarchy)
or else not RTE_Available (RE_Current_Master)
then
- declare
- Expr : Node_Id;
-
- begin
- -- RE_Library_Task_Level is not always available in configurable
- -- RunTime
-
- if not RTE_Available (RE_Library_Task_Level) then
- Expr := Make_Integer_Literal (Loc, Uint_3);
- else
- Expr := New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc);
- end if;
-
- Master_Decl :=
- Make_Object_Declaration (Loc,
- Defining_Identifier =>
- Make_Defining_Identifier (Loc, Name_uMaster),
- Constant_Present => True,
- Object_Definition =>
- New_Occurrence_Of (Standard_Integer, Loc),
- Expression => Expr);
- end;
+ Master_Decl :=
+ Make_Object_Declaration (Loc,
+ Defining_Identifier =>
+ Make_Defining_Identifier (Loc, Name_uMaster),
+ Constant_Present => True,
+ Object_Definition =>
+ New_Occurrence_Of (Standard_Integer, Loc),
+ Expression =>
+ Make_Integer_Literal (Loc, Library_Task_Level));
-- Generate:
-- _master : constant Integer := Current_Master.all;
@@ -3628,7 +3615,8 @@ package body Exp_Ch9 is
Master_Decl :=
Make_Object_Renaming_Declaration (Loc,
Defining_Identifier => Master_Id,
- Subtype_Mark => New_Occurrence_Of (RTE (RE_Master_Id), Loc),
+ Subtype_Mark =>
+ New_Occurrence_Of (Standard_Integer, Loc),
Name => Make_Identifier (Loc, Name_uMaster));
Insert_Action (Context, Master_Decl);
@@ -14710,8 +14698,7 @@ package body Exp_Ch9 is
if Restriction_Active (No_Task_Hierarchy) = False then
Append_To (Args, Make_Identifier (Loc, Name_uMaster));
else
- Append_To (Args,
- New_Occurrence_Of (RTE (RE_Library_Task_Level), Loc));
+ Append_To (Args, Make_Integer_Literal (Loc, Library_Task_Level));
end if;
end if;
diff --git a/gcc/ada/libgnarl/s-taskin.ads b/gcc/ada/libgnarl/s-taskin.ads
index f095c66..5c03829 100644
--- a/gcc/ada/libgnarl/s-taskin.ads
+++ b/gcc/ada/libgnarl/s-taskin.ads
@@ -773,6 +773,9 @@ package System.Tasking is
Environment_Task_Level : constant Master_Level := 1;
Independent_Task_Level : constant Master_Level := 2;
Library_Task_Level : constant Master_Level := 3;
+ -- Note that the value of Library_Task_Level is also hard coded in the
+ -- compiler, see Rtsfind.Library_Task_Level. The two should be kept in
+ -- sync.
-------------------
-- Priority info --
diff --git a/gcc/ada/rtsfind.ads b/gcc/ada/rtsfind.ads
index 39e4fb2..ef17cf2 100644
--- a/gcc/ada/rtsfind.ads
+++ b/gcc/ada/rtsfind.ads
@@ -29,6 +29,7 @@
-- not been explicitly With'ed.
with Types; use Types;
+with Uintp; use Uintp;
package Rtsfind is
@@ -1975,11 +1976,6 @@ package Rtsfind is
RE_Conditional_Call, -- System.Tasking
RE_Asynchronous_Call, -- System.Tasking
- RE_Foreign_Task_Level, -- System.Tasking
- RE_Environment_Task_Level, -- System.Tasking
- RE_Independent_Task_Level, -- System.Tasking
- RE_Library_Task_Level, -- System.Tasking
-
RE_Ada_Task_Control_Block, -- System.Tasking
RE_Task_List, -- System.Tasking
@@ -1996,7 +1992,6 @@ package Rtsfind is
RE_Task_Entry_Index, -- System.Tasking
RE_Self, -- System.Tasking
- RE_Master_Id, -- System.Tasking
RE_Unspecified_Priority, -- System.Tasking
RE_Activation_Chain, -- System.Tasking
@@ -3665,11 +3660,6 @@ package Rtsfind is
RE_Conditional_Call => System_Tasking,
RE_Asynchronous_Call => System_Tasking,
- RE_Foreign_Task_Level => System_Tasking,
- RE_Environment_Task_Level => System_Tasking,
- RE_Independent_Task_Level => System_Tasking,
- RE_Library_Task_Level => System_Tasking,
-
RE_Ada_Task_Control_Block => System_Tasking,
RE_Task_List => System_Tasking,
@@ -3686,7 +3676,6 @@ package Rtsfind is
RE_Task_Entry_Index => System_Tasking,
RE_Self => System_Tasking,
- RE_Master_Id => System_Tasking,
RE_Unspecified_Priority => System_Tasking,
RE_Activation_Chain => System_Tasking,
@@ -3994,6 +3983,9 @@ package Rtsfind is
System_Unsigned_Types => True,
others => False);
+ Library_Task_Level : constant Uint := Uint_3;
+ -- Corresponds to System.Tasking.Library_Task_Level
+
-----------------
-- Subprograms --
-----------------
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index ed6b09a..d707b0e 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -9042,7 +9042,7 @@ package body Sem_Ch6 is
if Needs_BIP_Task_Actuals (E) then
Discard :=
Add_Extra_Formal
- (E, RTE (RE_Master_Id),
+ (E, Standard_Integer,
E, BIP_Formal_Suffix (BIP_Task_Master));
Set_Has_Master_Entity (E);