aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2021-02-03 11:11:26 +0100
committerEric Botcazou <ebotcazou@adacore.com>2021-02-03 11:12:50 +0100
commitfc130ab54fd9a254f07426f9c180c367b039d7f9 (patch)
treefe1aeb09dfc044ff08612650600835286de256b1 /gcc/ada/gcc-interface/utils.c
parente3f9f80bfa9e58a90dfe75631921c78660342daf (diff)
downloadgcc-fc130ab54fd9a254f07426f9c180c367b039d7f9.zip
gcc-fc130ab54fd9a254f07426f9c180c367b039d7f9.tar.gz
gcc-fc130ab54fd9a254f07426f9c180c367b039d7f9.tar.bz2
Assorted LTO fixes for Ada
This polishes a few rough edges visible in LTO mode. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity) <E_Array_Type>: Make the two fields of the fat pointer type addressable, and do not make the template type read-only. <E_Record_Type>: If the type has discriminants mark it as may_alias. * gcc-interface/utils.c (make_dummy_type): Likewise. (build_dummy_unc_pointer_types): Likewise.
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index c503bfb..2656f11 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -467,6 +467,11 @@ make_dummy_type (Entity_Id gnat_type)
= create_type_stub_decl (TYPE_NAME (gnu_type), gnu_type);
if (Is_By_Reference_Type (gnat_equiv))
TYPE_BY_REFERENCE_P (gnu_type) = 1;
+ if (Has_Discriminants (gnat_equiv))
+ decl_attributes (&gnu_type,
+ tree_cons (get_identifier ("may_alias"), NULL_TREE,
+ NULL_TREE),
+ ATTR_FLAG_TYPE_IN_PLACE);
SET_DUMMY_NODE (gnat_equiv, gnu_type);
@@ -516,10 +521,10 @@ build_dummy_unc_pointer_types (Entity_Id gnat_desig_type, tree gnu_desig_type)
= create_type_stub_decl (create_concat_name (gnat_desig_type, "XUP"),
gnu_fat_type);
fields = create_field_decl (get_identifier ("P_ARRAY"), gnu_ptr_array,
- gnu_fat_type, NULL_TREE, NULL_TREE, 0, 0);
+ gnu_fat_type, NULL_TREE, NULL_TREE, 0, 1);
DECL_CHAIN (fields)
= create_field_decl (get_identifier ("P_BOUNDS"), gnu_ptr_template,
- gnu_fat_type, NULL_TREE, NULL_TREE, 0, 0);
+ gnu_fat_type, NULL_TREE, NULL_TREE, 0, 1);
finish_fat_pointer_type (gnu_fat_type, fields);
SET_TYPE_UNCONSTRAINED_ARRAY (gnu_fat_type, gnu_desig_type);
/* Suppress debug info until after the type is completed. */