summaryrefslogtreecommitdiffstats
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2022-02-10 12:37:56 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-19 14:05:32 +0000
commitdfbdd4b9812b199a74dbb948b4eb54fb7bb30883 (patch)
tree607ee7b249d4cc2b8e79fbcfccaac02c2a8a1f58 /gcc
parent[Ada] Adjust copyright line (diff)
downloadgcc-dfbdd4b9812b199a74dbb948b4eb54fb7bb30883.tar.gz
gcc-dfbdd4b9812b199a74dbb948b4eb54fb7bb30883.tar.bz2
gcc-dfbdd4b9812b199a74dbb948b4eb54fb7bb30883.tar.xz
[Ada] Fix for internal error on semi-circular record aggregate
This creates a couple of record subtypes pointing to each other through access subtypes, and we break the circularity at the latter subtypes. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Record_Subtype>: If it is a special subtype designated by an access subtype, then defer the completion of incomplete types.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/gcc-interface/decl.cc14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index c096b0d08d3..075a7ebd372 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -2134,6 +2134,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
2134 suppress expanding incomplete types. */ 2134 suppress expanding incomplete types. */
2135 gnu_type = make_node (UNCONSTRAINED_ARRAY_TYPE); 2135 gnu_type = make_node (UNCONSTRAINED_ARRAY_TYPE);
2136 2136
2137 /* The component may refer to this type, so defer completion of any
2138 incomplete types. */
2137 if (!definition) 2139 if (!definition)
2138 { 2140 {
2139 defer_incomplete_level++; 2141 defer_incomplete_level++;
@@ -3066,7 +3068,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
3066 3068
3067 process_attributes (&gnu_type, &attr_list, true, gnat_entity); 3069 process_attributes (&gnu_type, &attr_list, true, gnat_entity);
3068 3070
3069 /* If we are not defining it, suppress expanding incomplete types. */ 3071 /* Some component may refer to this type, so defer completion of any
3072 incomplete types. */
3070 if (!definition) 3073 if (!definition)
3071 { 3074 {
3072 defer_incomplete_level++; 3075 defer_incomplete_level++;
@@ -3439,7 +3442,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
3439 { 3442 {
3440 Entity_Id gnat_base_type = Implementation_Base_Type (gnat_entity); 3443 Entity_Id gnat_base_type = Implementation_Base_Type (gnat_entity);
3441 3444
3442 if (!definition) 3445 /* Some component may refer to this type, so defer completion of any
3446 incomplete types. We also need to do it for the special subtypes
3447 designated by access subtypes in case they are recursive, see the
3448 E_Access_Subtype case below. */
3449 if (!definition
3450 || (Is_Itype (gnat_entity)
3451 && Is_Frozen (gnat_entity)
3452 && No (Freeze_Node (gnat_entity))))
3443 { 3453 {
3444 defer_incomplete_level++; 3454 defer_incomplete_level++;
3445 this_deferred = true; 3455 this_deferred = true;