aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2016-06-06 10:03:14 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2016-06-06 10:03:14 +0000
commit42a5e4106a9418be069f14796112b069833e8fb1 (patch)
treeefc4ba3cae55863c40aeb0f4a0ccf5e96a83e8df /gcc
parentf8a9b81f106b8e37893d643f93458195702c6c98 (diff)
downloadgcc-42a5e4106a9418be069f14796112b069833e8fb1.zip
gcc-42a5e4106a9418be069f14796112b069833e8fb1.tar.gz
gcc-42a5e4106a9418be069f14796112b069833e8fb1.tar.bz2
decl.c (Gigi_Equivalent_Type): Make sure equivalent types are present before returning them.
* gcc-interface/decl.c (Gigi_Equivalent_Type): Make sure equivalent types are present before returning them. Remove final assertion. (gnat_to_gnu_entity) <E_Access_Protected_Subprogram_Type>: Adjust to above change. <E_Protected_Type>: Likewise. From-SVN: r237130
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog8
-rw-r--r--gcc/ada/gcc-interface/decl.c21
2 files changed, 20 insertions, 9 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 5ffc248..20edf04 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,13 @@
2016-06-06 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interface/decl.c (Gigi_Equivalent_Type): Make sure equivalent
+ types are present before returning them. Remove final assertion.
+ (gnat_to_gnu_entity) <E_Access_Protected_Subprogram_Type>: Adjust to
+ above change.
+ <E_Protected_Type>: Likewise.
+
+2016-06-06 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/trans.c (elaborate_all_entities_for_package): Also do
not elaborate Itypes.
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index c3aee48..45878a7 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -4009,9 +4009,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
case E_Access_Protected_Subprogram_Type:
case E_Anonymous_Access_Protected_Subprogram_Type:
- /* The run-time representation is the equivalent type. */
- if (type_annotate_only && No (gnat_equiv_type))
+ /* If we are just annotating types and have no equivalent record type,
+ just return ptr_void_type. */
+ if (type_annotate_only && gnat_equiv_type == gnat_entity)
gnu_type = ptr_type_node;
+
+ /* The run-time representation is the equivalent type. */
else
{
gnu_type = gnat_to_gnu_type (gnat_equiv_type);
@@ -4377,7 +4380,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
just return void_type, except for root types that have discriminants
because the discriminants will very likely be used in the declarative
part of the associated body so they need to be translated. */
- if (type_annotate_only && No (gnat_equiv_type))
+ if (type_annotate_only && gnat_equiv_type == gnat_entity)
{
if (Has_Discriminants (gnat_entity)
&& Root_Type (gnat_entity) == gnat_entity)
@@ -5143,26 +5146,26 @@ Gigi_Equivalent_Type (Entity_Id gnat_entity)
case E_Access_Protected_Subprogram_Type:
case E_Anonymous_Access_Protected_Subprogram_Type:
- gnat_equiv = Equivalent_Type (gnat_entity);
+ if (Present (Equivalent_Type (gnat_entity)))
+ gnat_equiv = Equivalent_Type (gnat_entity);
break;
case E_Class_Wide_Type:
gnat_equiv = Root_Type (gnat_entity);
break;
- case E_Task_Type:
- case E_Task_Subtype:
case E_Protected_Type:
case E_Protected_Subtype:
- gnat_equiv = Corresponding_Record_Type (gnat_entity);
+ case E_Task_Type:
+ case E_Task_Subtype:
+ if (Present (Corresponding_Record_Type (gnat_entity)))
+ gnat_equiv = Corresponding_Record_Type (gnat_entity);
break;
default:
break;
}
- gcc_assert (Present (gnat_equiv) || type_annotate_only);
-
return gnat_equiv;
}