aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r--gcc/ada/gcc-interface/decl.c19
-rw-r--r--gcc/ada/gcc-interface/utils.c9
2 files changed, 19 insertions, 9 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index 80ad5a3..5b6d2f7 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -160,7 +160,7 @@ static bool compile_time_known_address_p (Node_Id);
static bool cannot_be_superflat_p (Node_Id);
static bool constructor_address_p (tree);
static void components_to_record (tree, Node_Id, tree, int, bool, bool, bool,
- bool, bool, bool, bool, tree, tree *);
+ bool, bool, bool, bool, bool, tree, tree *);
static Uint annotate_value (tree);
static void annotate_rep (Entity_Id, tree);
static tree build_position_list (tree, bool, tree, tree, unsigned int, tree);
@@ -3128,7 +3128,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
/* Add the fields into the record type and finish it up. */
components_to_record (gnu_type, Component_List (record_definition),
gnu_field_list, packed, definition, false,
- all_rep, is_unchecked_union, debug_info_p,
+ all_rep, is_unchecked_union,
+ !Comes_From_Source (gnat_entity), debug_info_p,
false, OK_To_Reorder_Components (gnat_entity),
all_rep ? NULL_TREE : bitsize_zero_node, NULL);
@@ -7275,6 +7276,8 @@ compare_field_bitpos (const PTR rt1, const PTR rt2)
UNCHECKED_UNION is true if we are building this type for a record with a
Pragma Unchecked_Union.
+ ARTIFICIAL is true if this is a type that was generated by the compiler.
+
DEBUG_INFO is true if we need to write debug information about the type.
MAYBE_UNUSED is true if this type may be unused in the end; this doesn't
@@ -7294,8 +7297,8 @@ static void
components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
tree gnu_field_list, int packed, bool definition,
bool cancel_alignment, bool all_rep,
- bool unchecked_union, bool debug_info,
- bool maybe_unused, bool reorder,
+ bool unchecked_union, bool artificial,
+ bool debug_info, bool maybe_unused, bool reorder,
tree first_free_pos, tree *p_gnu_rep_list)
{
bool all_rep_and_size = all_rep && TYPE_SIZE (gnu_record_type);
@@ -7464,7 +7467,8 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
components_to_record (gnu_variant_type, Component_List (variant),
NULL_TREE, packed, definition,
!all_rep_and_size, all_rep, unchecked_union,
- debug_info, true, reorder, this_first_free_pos,
+ true, debug_info, true, reorder,
+ this_first_free_pos,
all_rep || this_first_free_pos
? NULL : &gnu_rep_list);
@@ -7706,7 +7710,10 @@ components_to_record (tree gnu_record_type, Node_Id gnat_component_list,
TYPE_ALIGN (gnu_record_type) = 0;
finish_record_type (gnu_record_type, nreverse (gnu_field_list),
- layout_with_rep ? 1 : 0, debug_info && !maybe_unused);
+ layout_with_rep ? 1 : 0, false);
+ TYPE_ARTIFICIAL (gnu_record_type) = artificial;
+ if (debug_info && !maybe_unused)
+ rest_of_record_type_compilation (gnu_record_type);
}
/* Given GNU_SIZE, a GCC tree representing a size, return a Uint to be
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index ab405db..062df3a 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -918,8 +918,6 @@ rest_of_record_type_compilation (tree record_type)
TYPE_SIZE_UNIT (new_record_type)
= size_int (TYPE_ALIGN (record_type) / BITS_PER_UNIT);
- add_parallel_type (TYPE_STUB_DECL (record_type), new_record_type);
-
/* Now scan all the fields, replacing each field with a new
field corresponding to the new encoding. */
for (old_field = TYPE_FIELDS (record_type); old_field;
@@ -1058,7 +1056,12 @@ rest_of_record_type_compilation (tree record_type)
TYPE_FIELDS (new_record_type)
= nreverse (TYPE_FIELDS (new_record_type));
- rest_of_type_decl_compilation (TYPE_STUB_DECL (new_record_type));
+ /* We used to explicitly invoke rest_of_type_decl_compilation on the
+ parallel type for the sake of STABS. We don't do it any more, so
+ as to ensure that the parallel type be processed after the type
+ by the debug back-end and, thus, prevent it from interfering with
+ the processing of a recursive type. */
+ add_parallel_type (TYPE_STUB_DECL (record_type), new_record_type);
}
rest_of_type_decl_compilation (TYPE_STUB_DECL (record_type));