diff options
author | Thomas Quinot <quinot@adacore.com> | 2018-09-26 09:17:26 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-09-26 09:17:26 +0000 |
commit | 52ba224d888aead9a9f00ce04b14200f2f4ef8a5 (patch) | |
tree | c80771441e64a141ee62f04e0560900d1d446924 /gcc/ada | |
parent | b45a9ff305f536031a12509c6c6e7aea9cb7f884 (diff) | |
download | gcc-52ba224d888aead9a9f00ce04b14200f2f4ef8a5.zip gcc-52ba224d888aead9a9f00ce04b14200f2f4ef8a5.tar.gz gcc-52ba224d888aead9a9f00ce04b14200f2f4ef8a5.tar.bz2 |
[Ada] Propagate bit order and SSO from root to classwide equivalent type
2018-09-26 Thomas Quinot <quinot@adacore.com>
gcc/ada/
* exp_util.adb (Make_CW_Equivalent_Type): Propagate bit order
and scalar storage order from root type to classwide equivalent
type, to prevent rejection of the equivalent type by the
freezing circuitry.
gcc/testsuite/
* gnat.dg/sso12.adb: New testcase.
From-SVN: r264613
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/ada/exp_util.adb | 17 |
2 files changed, 21 insertions, 3 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 4ab1bcd..94f90d3 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,10 @@ +2018-09-26 Thomas Quinot <quinot@adacore.com> + + * exp_util.adb (Make_CW_Equivalent_Type): Propagate bit order + and scalar storage order from root type to classwide equivalent + type, to prevent rejection of the equivalent type by the + freezing circuitry. + 2018-09-26 Justin Squirek <squirek@adacore.com> * sem_ch5.adb (Analyze_Iterator_Specification): Add conditional diff --git a/gcc/ada/exp_util.adb b/gcc/ada/exp_util.adb index 314e3ee..31e36ee 100644 --- a/gcc/ada/exp_util.adb +++ b/gcc/ada/exp_util.adb @@ -9004,12 +9004,17 @@ package body Exp_Util is -- Generate the following code: -- type Equiv_T is record - -- _parent : T (List of discriminant constraints taken from Exp); + -- _parent : T (List of discriminant constraints taken from Exp); -- Ext__50 : Storage_Array (1 .. (Exp'size - Typ'object_size)/8); -- end Equiv_T; -- - -- ??? Note that this type does not guarantee same alignment as all - -- derived types + -- ??? Note that this type does not guarantee same alignment as all + -- derived types + -- + -- Note: for the freezing circuitry, this looks like a record extension, + -- and so we need to make sure that the scalar storage order is the same + -- as that of the parent type. (This does not change anything for the + -- representation of the extension part.) function Make_CW_Equivalent_Type (T : Entity_Id; @@ -9017,6 +9022,7 @@ package body Exp_Util is is Loc : constant Source_Ptr := Sloc (E); Root_Typ : constant Entity_Id := Root_Type (T); + Root_Utyp : constant Entity_Id := Underlying_Type (Root_Typ); List_Def : constant List_Id := Empty_List; Comp_List : constant List_Id := New_List; Equiv_Type : Entity_Id; @@ -9147,6 +9153,11 @@ package body Exp_Util is Make_Component_Definition (Loc, Aliased_Present => False, Subtype_Indication => New_Occurrence_Of (Constr_Root, Loc)))); + + Set_Reverse_Storage_Order (Equiv_Type, + Reverse_Storage_Order (Base_Type (Root_Utyp))); + Set_Reverse_Bit_Order (Equiv_Type, + Reverse_Bit_Order (Base_Type (Root_Utyp))); end if; Append_To (Comp_List, |