diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2017-09-09 12:41:19 +0000 |
---|---|---|
committer | Eric Botcazou <ebotcazou@gcc.gnu.org> | 2017-09-09 12:41:19 +0000 |
commit | 87eddedc5f9ae385958edd24d9d42981f702ecb2 (patch) | |
tree | 7ec293a0b3b9c586c01489ba5104e89c78378201 /gcc/ada/gcc-interface/decl.c | |
parent | f4657d60cf7027c595f2df132b6d6c20435077a4 (diff) | |
download | gcc-87eddedc5f9ae385958edd24d9d42981f702ecb2.zip gcc-87eddedc5f9ae385958edd24d9d42981f702ecb2.tar.gz gcc-87eddedc5f9ae385958edd24d9d42981f702ecb2.tar.bz2 |
decl.c (gnat_to_gnu_entity): Copy the layout of the record from the parent type only if...
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Record_Type>: Copy the
layout of the record from the parent type only if both are or are not
unchecked unions.
(is_stored_discriminant): Return false for an unchecked union.
From-SVN: r251934
Diffstat (limited to 'gcc/ada/gcc-interface/decl.c')
-rw-r--r-- | gcc/ada/gcc-interface/decl.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index 2a31e8f..f8752c8 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -3287,15 +3287,15 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) } /* If this is a derived type with discriminants and these discriminants - affect the initial shape it has inherited, factor them in. But for - an Unchecked_Union (it must be an Itype), just process the type. */ + affect the initial shape it has inherited, factor them in. */ if (has_discr && !is_extension && !Has_Record_Rep_Clause (gnat_entity) && Stored_Constraint (gnat_entity) != No_Elist && (gnat_parent_type = Underlying_Type (Etype (gnat_entity))) && Is_Record_Type (gnat_parent_type) - && !Is_Unchecked_Union (gnat_parent_type) + && Is_Unchecked_Union (gnat_entity) + == Is_Unchecked_Union (gnat_parent_type) && No_Reordering (gnat_entity) == No_Reordering (gnat_parent_type)) { tree gnu_parent_type @@ -9328,7 +9328,9 @@ copy_and_substitute_in_size (tree new_type, tree old_type, static inline bool is_stored_discriminant (Entity_Id discr, Entity_Id record_type) { - if (Is_Tagged_Type (record_type)) + if (Is_Unchecked_Union (record_type)) + return false; + else if (Is_Tagged_Type (record_type)) return No (Corresponding_Discriminant (discr)); else if (Ekind (record_type) == E_Record_Type) return Original_Record_Component (discr) == discr; |