aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2018-05-24 13:04:29 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2018-05-24 13:04:29 +0000
commit0b5252ac694ea0393cc9443ef2cebcab60bab40d (patch)
tree73988d7a8919b6e1af5fa6729812a6d95573546c
parent7dcac7d1468a3b5b69f5a04d2ca0919b515fddba (diff)
downloadgcc-0b5252ac694ea0393cc9443ef2cebcab60bab40d.zip
gcc-0b5252ac694ea0393cc9443ef2cebcab60bab40d.tar.gz
gcc-0b5252ac694ea0393cc9443ef2cebcab60bab40d.tar.bz2
[Ada] Spurious error on private task derivation
The compiler reports a spurious error notifying a missing constraint in the declaration of a private type with discriminants whose full view is a derivation of a task type. After this patch the following test compiles without errors. package Types1 is type Parent (Discr1 : Boolean) is limited private; private task type Parent (Discr1 : Boolean); end Types1; with Types1; use Types1; package Types2 is type Child (Discr2 : Boolean) is limited private; private type Child (Discr2 : Boolean) is -- Test new Parent (Discr1 => Discr2); end Types2; Command: gcc -c types2.ads 2018-05-24 Javier Miranda <miranda@adacore.com> gcc/ada/ * sem_util.adb (Abstract_Interface_List): Add missing support for private types whose full view is a synchronized type. * sem_ch3.adb (Build_Derived_Private_Type): Skip building the full derivation of a private type parent type is a task type with discriminants as gigi does not use such type directly. From-SVN: r260644
-rw-r--r--gcc/ada/ChangeLog8
-rw-r--r--gcc/ada/sem_ch3.adb4
-rw-r--r--gcc/ada/sem_util.adb8
3 files changed, 14 insertions, 6 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 8d4b0fc..ea9a682 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,11 @@
+2018-05-24 Javier Miranda <miranda@adacore.com>
+
+ * sem_util.adb (Abstract_Interface_List): Add missing support for
+ private types whose full view is a synchronized type.
+ * sem_ch3.adb (Build_Derived_Private_Type): Skip building the full
+ derivation of a private type parent type is a task type with
+ discriminants as gigi does not use such type directly.
+
2018-05-24 Hristian Kirtchev <kirtchev@adacore.com>
* sem_elab.adb (Build_Variable_Reference_Marker): Do not create a
diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb
index 9f23b56..4887e86 100644
--- a/gcc/ada/sem_ch3.adb
+++ b/gcc/ada/sem_ch3.adb
@@ -7856,12 +7856,12 @@ package body Sem_Ch3 is
-- Build the full derivation if this is not the anonymous derived
-- base type created by Build_Derived_Record_Type in the constrained
-- case (see point 5. of its head comment) since we build it for the
- -- derived subtype. And skip it for protected types altogether, as
+ -- derived subtype. And skip it for synchronized types altogether, as
-- gigi does not use these types directly.
if Present (Full_View (Parent_Type))
and then not Is_Itype (Derived_Type)
- and then not (Ekind (Full_View (Parent_Type)) in Protected_Kind)
+ and then not (Is_Concurrent_Type (Full_View (Parent_Type)))
then
declare
Der_Base : constant Entity_Id := Base_Type (Derived_Type);
diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 2d516ff..76b4fb0 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -184,11 +184,11 @@ package body Sem_Util is
-- If we are dealing with a synchronized subtype, go to the base
-- type, whose declaration has the interface list.
- -- Shouldn't this be Declaration_Node???
+ Nod := Declaration_Node (Base_Type (Typ));
- Nod := Parent (Base_Type (Typ));
-
- if Nkind (Nod) = N_Full_Type_Declaration then
+ if Nkind_In (Nod, N_Full_Type_Declaration,
+ N_Private_Type_Declaration)
+ then
return Empty_List;
end if;