aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Dismukes <dismukes@adacore.com>2019-08-21 08:30:17 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-08-21 08:30:17 +0000
commit830c5948106c441435731ada9084cba8595bb407 (patch)
tree06a399da578e75da19912bb717f56682679b5449
parentbde9a2c227e1c78215ab881de9a7eba29f45c37f (diff)
downloadgcc-830c5948106c441435731ada9084cba8595bb407.zip
gcc-830c5948106c441435731ada9084cba8595bb407.tar.gz
gcc-830c5948106c441435731ada9084cba8595bb407.tar.bz2
[Ada] Undefined master in task with limited class-wide aliased entry formal
In the case of a task declaring an entry with an aliased formal parameter of a limited class-wide type, the front end was creating a master object (_master) for the access type generated for such an entry formal inside the task specification, even though such access types don't need an associated master. The master object wasn't being copied into the procedure expanded for the task body, but a renaming for the master appeared in the statements of the task body, and the LLVM back end rejects this since the master object doesn't appear in the expanded task procedure (for some reason, gigi doesn't complain). This is fixed by suppressing the creation of the master object in the case where the access-to-limited-class-wide access type is the type of a component in an entry's parameter block. This is similar to the suppression done for the master object in other cases, where the access type designates a type explicitly containing tasks (though the suppression involves testing Comes_From_Source in that case). No simple test (and this only affects the LLVM-based compiler). 2019-08-21 Gary Dismukes <dismukes@adacore.com> gcc/ada/ * exp_ch3.adb (Build_Master): Suppress call to Build_Class_Wide_Master in the case where the access-to-limited-class-wide type was created for a component in an entry's formal parameter block (Is_Parameter_Block_Component_Type), to prevent a master from being created for such access types generated by the front end in a task spec for entry formals in a parameter block. Add a ??? about whether this suppression should be done more generally (such as by using Comes_From_Source). From-SVN: r274783
-rw-r--r--gcc/ada/ChangeLog12
-rw-r--r--gcc/ada/exp_ch3.adb9
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index c27e6e5..29617b0 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,15 @@
+2019-08-21 Gary Dismukes <dismukes@adacore.com>
+
+ * exp_ch3.adb (Build_Master): Suppress call to
+ Build_Class_Wide_Master in the case where the
+ access-to-limited-class-wide type was created for a component in
+ an entry's formal parameter
+ block (Is_Parameter_Block_Component_Type), to prevent a master
+ from being created for such access types generated by the front
+ end in a task spec for entry formals in a parameter block. Add
+ a ??? about whether this suppression should be done more
+ generally (such as by using Comes_From_Source).
+
2019-08-21 Eric Botcazou <ebotcazou@adacore.com>
* exp_ch6.adb (Expand_N_Extended_Return_Statement): In the case
diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb
index 1901ea5..8763600 100644
--- a/gcc/ada/exp_ch3.adb
+++ b/gcc/ada/exp_ch3.adb
@@ -5518,7 +5518,14 @@ package body Exp_Ch3 is
-- Note: This code covers access-to-limited-interfaces because they
-- can be used to reference tasks implementing them.
- elsif Is_Limited_Class_Wide_Type (Desig_Typ)
+ -- Suppress the master creation for access types created for entry
+ -- formal parameters (parameter block component types). Seems like
+ -- suppression should be more general for compiler-generated types,
+ -- but testing Comes_From_Source, like the code above does, may be
+ -- too general in this case (affects some test output)???
+
+ elsif not Is_Param_Block_Component_Type (Ptr_Typ)
+ and then Is_Limited_Class_Wide_Type (Desig_Typ)
and then Tasking_Allowed
then
Build_Class_Wide_Master (Ptr_Typ);