static tree gnat_to_gnu_field (Entity_Id, tree, int, bool, bool);
static tree gnu_ext_name_for_subprog (Entity_Id, tree);
static tree change_qualified_type (tree, int);
+static void set_nonaliased_component_on_array_type (tree);
+static void set_reverse_storage_order_on_array_type (tree);
static bool same_discriminant_p (Entity_Id, Entity_Id);
static bool array_type_has_nonaliased_component (tree, Entity_Id);
static bool compile_time_known_address_p (Node_Id);
for (index = ndim - 1; index >= 0; index--)
{
tem = build_nonshared_array_type (tem, gnu_index_types[index]);
- if (index == ndim - 1)
- TYPE_REVERSE_STORAGE_ORDER (tem)
- = Reverse_Storage_Order (gnat_entity);
TYPE_MULTI_ARRAY_P (tem) = (index > 0);
+ TYPE_CONVENTION_FORTRAN_P (tem) = convention_fortran_p;
+ if (index == ndim - 1 && Reverse_Storage_Order (gnat_entity))
+ set_reverse_storage_order_on_array_type (tem);
if (array_type_has_nonaliased_component (tem, gnat_entity))
- TYPE_NONALIASED_COMPONENT (tem) = 1;
+ set_nonaliased_component_on_array_type (tem);
}
/* If an alignment is specified, use it if valid. But ignore it
TYPE_USER_ALIGN (tem) = 1;
}
- TYPE_CONVENTION_FORTRAN_P (tem) = convention_fortran_p;
-
/* Tag top-level ARRAY_TYPE nodes for packed arrays and their
implementation types as such so that the debug information back-end
can output the appropriate description for them. */
{
gnu_type = build_nonshared_array_type (gnu_type,
gnu_index_types[index]);
- if (index == ndim - 1)
- TYPE_REVERSE_STORAGE_ORDER (gnu_type)
- = Reverse_Storage_Order (gnat_entity);
TYPE_MULTI_ARRAY_P (gnu_type) = (index > 0);
+ TYPE_CONVENTION_FORTRAN_P (gnu_type) = convention_fortran_p;
+ if (index == ndim - 1 && Reverse_Storage_Order (gnat_entity))
+ set_reverse_storage_order_on_array_type (gnu_type);
if (array_type_has_nonaliased_component (gnu_type, gnat_entity))
- TYPE_NONALIASED_COMPONENT (gnu_type) = 1;
+ set_nonaliased_component_on_array_type (gnu_type);
}
/* Strip the ___XP suffix for standard DWARF. */
}
}
- TYPE_CONVENTION_FORTRAN_P (gnu_type) = convention_fortran_p;
TYPE_PACKED_ARRAY_TYPE_P (gnu_type)
= (Is_Packed_Array_Impl_Type (gnat_entity)
&& Is_Bit_Packed_Array (Original_Array_Type (gnat_entity)));
(Component_Type (gnat_entity)),
gnu_index_type);
if (array_type_has_nonaliased_component (gnu_type, gnat_entity))
- TYPE_NONALIASED_COMPONENT (gnu_type) = 1;
+ set_nonaliased_component_on_array_type (gnu_type);
relate_alias_sets (gnu_type, gnu_string_type, ALIAS_SET_COPY);
}
break;
return build_qualified_type (type, TYPE_QUALS (type) | type_quals);
}
+/* Set TYPE_NONALIASED_COMPONENT on an array type built by means of
+ build_nonshared_array_type. */
+
+static void
+set_nonaliased_component_on_array_type (tree type)
+{
+ TYPE_NONALIASED_COMPONENT (type) = 1;
+ TYPE_NONALIASED_COMPONENT (TYPE_CANONICAL (type)) = 1;
+}
+
+/* Set TYPE_REVERSE_STORAGE_ORDER on an array type built by means of
+ build_nonshared_array_type. */
+
+static void
+set_reverse_storage_order_on_array_type (tree type)
+{
+ TYPE_REVERSE_STORAGE_ORDER (type) = 1;
+ TYPE_REVERSE_STORAGE_ORDER (TYPE_CANONICAL (type)) = 1;
+}
+
/* Return true if DISCR1 and DISCR2 represent the same discriminant. */
static bool
SET_TYPE_MODE (nt, TYPE_MODE (t));
TYPE_SIZE (nt) = SUBSTITUTE_IN_EXPR (TYPE_SIZE (t), f, r);
TYPE_SIZE_UNIT (nt) = SUBSTITUTE_IN_EXPR (TYPE_SIZE_UNIT (t), f, r);
- TYPE_NONALIASED_COMPONENT (nt) = TYPE_NONALIASED_COMPONENT (t);
TYPE_MULTI_ARRAY_P (nt) = TYPE_MULTI_ARRAY_P (t);
TYPE_CONVENTION_FORTRAN_P (nt) = TYPE_CONVENTION_FORTRAN_P (t);
+ if (TYPE_REVERSE_STORAGE_ORDER (t))
+ set_reverse_storage_order_on_array_type (nt);
+ if (TYPE_NONALIASED_COMPONENT (t))
+ set_nonaliased_component_on_array_type (nt);
return nt;
}
|| TREE_CODE (t) == POINTER_TYPE
|| TYPE_IS_FAT_POINTER_P (t)))
{
- tree tt;
- /* ??? Copy and original type are not supposed to be variant but we
- really need a variant for the placeholder machinery to work. */
- if (TYPE_IS_FAT_POINTER_P (t))
- tt = build_variant_type_copy (t);
- else
- {
- /* TYPE_NEXT_PTR_TO is a chain of main variants. */
- tt = build_distinct_type_copy (TYPE_MAIN_VARIANT (t));
- if (TREE_CODE (t) == POINTER_TYPE)
- TYPE_NEXT_PTR_TO (TYPE_MAIN_VARIANT (t)) = tt;
- tt = build_qualified_type (tt, TYPE_QUALS (t));
- }
+ tree tt = build_variant_type_copy (t);
TYPE_NAME (tt) = decl;
defer_or_set_type_context (tt,
DECL_CONTEXT (decl),
deferred_decl_context);
- TREE_USED (tt) = TREE_USED (t);
TREE_TYPE (decl) = tt;
if (TYPE_NAME (t)
&& TREE_CODE (TYPE_NAME (t)) == TYPE_DECL