From 2ae3bbe5b8afe60cb13b6a3314f39e6aa99b7e37 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Fri, 20 Sep 2024 20:24:55 +0200 Subject: [PATCH] ada: Remove use of overlays in implementation of System.Pack_N units The implementation uses an overlay between an address and an access value, which is convoluted. This changes it to use a direct conversion instead. No functional changes (and no changes to generated code at -O2). gcc/ada/ChangeLog: * s-pack.adb.tmpl: Add "with System.Address_To_Access_Conversions". (Cluster_Ref): Delete. (AAC): New instance of System.Address_To_Access_Conversions. (Rev_Cluster_Ref): Delete. (Rev_ACC): New instance of System.Address_To_Access_Conversions. (ClusterU_Ref): Delete. (AACU): New instance of System.Address_To_Access_Conversions. (Rev_ClusterU_Ref): Delete. (Rev_ACCU): New instance of System.Address_To_Access_Conversions. (Get_@@): Use a direct address-to-access conversion. (GetU_@@): Likewise. (Set_@@): Likewise. (SetU_@@): Likewise. * libgnat/s-pack03.adb: Regenerate. * libgnat/s-pack05.adb: Likewise. * libgnat/s-pack06.adb: Likewise. * libgnat/s-pack07.adb: Likewise. * libgnat/s-pack09.adb: Likewise. * libgnat/s-pack10.adb: Likewise. * libgnat/s-pack100.adb: Likewise. * libgnat/s-pack101.adb: Likewise. * libgnat/s-pack102.adb: Likewise. * libgnat/s-pack103.adb: Likewise. * libgnat/s-pack104.adb: Likewise. * libgnat/s-pack105.adb: Likewise. * libgnat/s-pack106.adb: Likewise. * libgnat/s-pack107.adb: Likewise. * libgnat/s-pack108.adb: Likewise. * libgnat/s-pack109.adb: Likewise. * libgnat/s-pack11.adb: Likewise. * libgnat/s-pack110.adb: Likewise. * libgnat/s-pack111.adb: Likewise. * libgnat/s-pack112.adb: Likewise. * libgnat/s-pack113.adb: Likewise. * libgnat/s-pack114.adb: Likewise. * libgnat/s-pack115.adb: Likewise. * libgnat/s-pack116.adb: Likewise. * libgnat/s-pack117.adb: Likewise. * libgnat/s-pack118.adb: Likewise. * libgnat/s-pack119.adb: Likewise. * libgnat/s-pack12.adb: Likewise. * libgnat/s-pack120.adb: Likewise. * libgnat/s-pack121.adb: Likewise. * libgnat/s-pack122.adb: Likewise. * libgnat/s-pack123.adb: Likewise. * libgnat/s-pack124.adb: Likewise. * libgnat/s-pack125.adb: Likewise. * libgnat/s-pack126.adb: Likewise. * libgnat/s-pack127.adb: Likewise. * libgnat/s-pack13.adb: Likewise. * libgnat/s-pack14.adb: Likewise. * libgnat/s-pack15.adb: Likewise. * libgnat/s-pack17.adb: Likewise. * libgnat/s-pack18.adb: Likewise. * libgnat/s-pack19.adb: Likewise. * libgnat/s-pack20.adb: Likewise. * libgnat/s-pack21.adb: Likewise. * libgnat/s-pack22.adb: Likewise. * libgnat/s-pack23.adb: Likewise. * libgnat/s-pack24.adb: Likewise. * libgnat/s-pack25.adb: Likewise. * libgnat/s-pack26.adb: Likewise. * libgnat/s-pack27.adb: Likewise. * libgnat/s-pack28.adb: Likewise. * libgnat/s-pack29.adb: Likewise. * libgnat/s-pack30.adb: Likewise. * libgnat/s-pack31.adb: Likewise. * libgnat/s-pack33.adb: Likewise. * libgnat/s-pack34.adb: Likewise. * libgnat/s-pack35.adb: Likewise. * libgnat/s-pack36.adb: Likewise. * libgnat/s-pack37.adb: Likewise. * libgnat/s-pack38.adb: Likewise. * libgnat/s-pack39.adb: Likewise. * libgnat/s-pack40.adb: Likewise. * libgnat/s-pack41.adb: Likewise. * libgnat/s-pack42.adb: Likewise. * libgnat/s-pack43.adb: Likewise. * libgnat/s-pack44.adb: Likewise. * libgnat/s-pack45.adb: Likewise. * libgnat/s-pack46.adb: Likewise. * libgnat/s-pack47.adb: Likewise. * libgnat/s-pack48.adb: Likewise. * libgnat/s-pack49.adb: Likewise. * libgnat/s-pack50.adb: Likewise. * libgnat/s-pack51.adb: Likewise. * libgnat/s-pack52.adb: Likewise. * libgnat/s-pack53.adb: Likewise. * libgnat/s-pack54.adb: Likewise. * libgnat/s-pack55.adb: Likewise. * libgnat/s-pack56.adb: Likewise. * libgnat/s-pack57.adb: Likewise. * libgnat/s-pack58.adb: Likewise. * libgnat/s-pack59.adb: Likewise. * libgnat/s-pack60.adb: Likewise. * libgnat/s-pack61.adb: Likewise. * libgnat/s-pack62.adb: Likewise. * libgnat/s-pack63.adb: Likewise. * libgnat/s-pack65.adb: Likewise. * libgnat/s-pack66.adb: Likewise. * libgnat/s-pack67.adb: Likewise. * libgnat/s-pack68.adb: Likewise. * libgnat/s-pack69.adb: Likewise. * libgnat/s-pack70.adb: Likewise. * libgnat/s-pack71.adb: Likewise. * libgnat/s-pack72.adb: Likewise. * libgnat/s-pack73.adb: Likewise. * libgnat/s-pack74.adb: Likewise. * libgnat/s-pack75.adb: Likewise. * libgnat/s-pack76.adb: Likewise. * libgnat/s-pack77.adb: Likewise. * libgnat/s-pack78.adb: Likewise. * libgnat/s-pack79.adb: Likewise. * libgnat/s-pack80.adb: Likewise. * libgnat/s-pack81.adb: Likewise. * libgnat/s-pack82.adb: Likewise. * libgnat/s-pack83.adb: Likewise. * libgnat/s-pack84.adb: Likewise. * libgnat/s-pack85.adb: Likewise. * libgnat/s-pack86.adb: Likewise. * libgnat/s-pack87.adb: Likewise. * libgnat/s-pack88.adb: Likewise. * libgnat/s-pack89.adb: Likewise. * libgnat/s-pack90.adb: Likewise. * libgnat/s-pack91.adb: Likewise. * libgnat/s-pack92.adb: Likewise. * libgnat/s-pack93.adb: Likewise. * libgnat/s-pack94.adb: Likewise. * libgnat/s-pack95.adb: Likewise. * libgnat/s-pack96.adb: Likewise. * libgnat/s-pack97.adb: Likewise. * libgnat/s-pack98.adb: Likewise. * libgnat/s-pack99.adb: Likewise. --- gcc/ada/libgnat/s-pack03.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack05.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack06.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack07.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack09.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack10.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack100.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack101.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack102.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack103.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack104.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack105.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack106.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack107.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack108.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack109.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack11.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack110.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack111.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack112.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack113.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack114.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack115.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack116.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack117.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack118.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack119.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack12.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack120.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack121.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack122.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack123.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack124.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack125.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack126.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack127.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack13.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack14.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack15.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack17.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack18.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack19.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack20.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack21.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack22.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack23.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack24.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack25.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack26.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack27.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack28.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack29.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack30.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack31.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack33.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack34.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack35.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack36.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack37.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack38.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack39.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack40.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack41.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack42.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack43.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack44.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack45.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack46.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack47.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack48.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack49.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack50.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack51.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack52.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack53.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack54.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack55.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack56.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack57.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack58.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack59.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack60.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack61.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack62.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack63.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack65.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack66.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack67.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack68.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack69.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack70.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack71.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack72.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack73.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack74.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack75.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack76.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack77.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack78.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack79.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack80.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack81.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack82.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack83.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack84.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack85.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack86.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack87.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack88.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack89.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack90.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack91.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack92.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack93.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack94.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack95.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack96.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack97.adb | 23 ++++++++++++------- gcc/ada/libgnat/s-pack98.adb | 42 ++++++++++++++++++++++------------- gcc/ada/libgnat/s-pack99.adb | 23 ++++++++++++------- gcc/ada/s-pack.adb.tmpl | 42 ++++++++++++++++++++++------------- 121 files changed, 2453 insertions(+), 1432 deletions(-) diff --git a/gcc/ada/libgnat/s-pack03.adb b/gcc/ada/libgnat/s-pack03.adb index 73f54db0f12b..56b036e91cba 100644 --- a/gcc/ada/libgnat/s-pack03.adb +++ b/gcc/ada/libgnat/s-pack03.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_03 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_03 -- @@ -85,9 +90,10 @@ package body System.Pack_03 is N : Natural; Rev_SSO : Boolean) return Bits_03 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_03 is E : Bits_03; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack05.adb b/gcc/ada/libgnat/s-pack05.adb index 48db6692236b..0abccaf9c907 100644 --- a/gcc/ada/libgnat/s-pack05.adb +++ b/gcc/ada/libgnat/s-pack05.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_05 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_05 -- @@ -85,9 +90,10 @@ package body System.Pack_05 is N : Natural; Rev_SSO : Boolean) return Bits_05 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_05 is E : Bits_05; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack06.adb b/gcc/ada/libgnat/s-pack06.adb index c27412c87bef..3b85634190ff 100644 --- a/gcc/ada/libgnat/s-pack06.adb +++ b/gcc/ada/libgnat/s-pack06.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_06 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_06 or SetU_06 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_06 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_06 -- @@ -100,9 +106,10 @@ package body System.Pack_06 is N : Natural; Rev_SSO : Boolean) return Bits_06 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_06 is N : Natural; Rev_SSO : Boolean) return Bits_06 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_06 is E : Bits_06; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_06 is E : Bits_06; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack07.adb b/gcc/ada/libgnat/s-pack07.adb index 159fb21e9efb..e93aca55d921 100644 --- a/gcc/ada/libgnat/s-pack07.adb +++ b/gcc/ada/libgnat/s-pack07.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_07 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_07 -- @@ -85,9 +90,10 @@ package body System.Pack_07 is N : Natural; Rev_SSO : Boolean) return Bits_07 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_07 is E : Bits_07; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack09.adb b/gcc/ada/libgnat/s-pack09.adb index a1fb415547ab..85bc49acb21e 100644 --- a/gcc/ada/libgnat/s-pack09.adb +++ b/gcc/ada/libgnat/s-pack09.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_09 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_09 -- @@ -85,9 +90,10 @@ package body System.Pack_09 is N : Natural; Rev_SSO : Boolean) return Bits_09 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_09 is E : Bits_09; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack10.adb b/gcc/ada/libgnat/s-pack10.adb index 42e1c3a2a3a1..6bf3ab76cbb9 100644 --- a/gcc/ada/libgnat/s-pack10.adb +++ b/gcc/ada/libgnat/s-pack10.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_10 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_10 or SetU_10 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_10 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_10 -- @@ -100,9 +106,10 @@ package body System.Pack_10 is N : Natural; Rev_SSO : Boolean) return Bits_10 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_10 is N : Natural; Rev_SSO : Boolean) return Bits_10 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_10 is E : Bits_10; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_10 is E : Bits_10; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack100.adb b/gcc/ada/libgnat/s-pack100.adb index 8429dafc3b80..b413f4589332 100644 --- a/gcc/ada/libgnat/s-pack100.adb +++ b/gcc/ada/libgnat/s-pack100.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_100 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_100 or SetU_100 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_100 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_100 -- @@ -100,9 +106,10 @@ package body System.Pack_100 is N : Natural; Rev_SSO : Boolean) return Bits_100 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_100 is N : Natural; Rev_SSO : Boolean) return Bits_100 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_100 is E : Bits_100; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_100 is E : Bits_100; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack101.adb b/gcc/ada/libgnat/s-pack101.adb index eb22abd4810a..5d5fdb3adee2 100644 --- a/gcc/ada/libgnat/s-pack101.adb +++ b/gcc/ada/libgnat/s-pack101.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_101 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_101 -- @@ -85,9 +90,10 @@ package body System.Pack_101 is N : Natural; Rev_SSO : Boolean) return Bits_101 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_101 is E : Bits_101; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack102.adb b/gcc/ada/libgnat/s-pack102.adb index 6ac093c8af64..b00f67bee2e8 100644 --- a/gcc/ada/libgnat/s-pack102.adb +++ b/gcc/ada/libgnat/s-pack102.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_102 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_102 or SetU_102 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_102 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_102 -- @@ -100,9 +106,10 @@ package body System.Pack_102 is N : Natural; Rev_SSO : Boolean) return Bits_102 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_102 is N : Natural; Rev_SSO : Boolean) return Bits_102 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_102 is E : Bits_102; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_102 is E : Bits_102; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack103.adb b/gcc/ada/libgnat/s-pack103.adb index a51ba946630f..0839c892d051 100644 --- a/gcc/ada/libgnat/s-pack103.adb +++ b/gcc/ada/libgnat/s-pack103.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_103 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_103 -- @@ -85,9 +90,10 @@ package body System.Pack_103 is N : Natural; Rev_SSO : Boolean) return Bits_103 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_103 is E : Bits_103; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack104.adb b/gcc/ada/libgnat/s-pack104.adb index 24f5fb46f9c5..b3430e5d214e 100644 --- a/gcc/ada/libgnat/s-pack104.adb +++ b/gcc/ada/libgnat/s-pack104.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_104 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_104 or SetU_104 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_104 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_104 -- @@ -100,9 +106,10 @@ package body System.Pack_104 is N : Natural; Rev_SSO : Boolean) return Bits_104 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_104 is N : Natural; Rev_SSO : Boolean) return Bits_104 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_104 is E : Bits_104; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_104 is E : Bits_104; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack105.adb b/gcc/ada/libgnat/s-pack105.adb index 53979475bde3..4355aca84fab 100644 --- a/gcc/ada/libgnat/s-pack105.adb +++ b/gcc/ada/libgnat/s-pack105.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_105 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_105 -- @@ -85,9 +90,10 @@ package body System.Pack_105 is N : Natural; Rev_SSO : Boolean) return Bits_105 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_105 is E : Bits_105; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack106.adb b/gcc/ada/libgnat/s-pack106.adb index bd1631ee2282..870ab724811b 100644 --- a/gcc/ada/libgnat/s-pack106.adb +++ b/gcc/ada/libgnat/s-pack106.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_106 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_106 or SetU_106 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_106 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_106 -- @@ -100,9 +106,10 @@ package body System.Pack_106 is N : Natural; Rev_SSO : Boolean) return Bits_106 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_106 is N : Natural; Rev_SSO : Boolean) return Bits_106 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_106 is E : Bits_106; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_106 is E : Bits_106; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack107.adb b/gcc/ada/libgnat/s-pack107.adb index b2e84acd22e4..22667170b901 100644 --- a/gcc/ada/libgnat/s-pack107.adb +++ b/gcc/ada/libgnat/s-pack107.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_107 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_107 -- @@ -85,9 +90,10 @@ package body System.Pack_107 is N : Natural; Rev_SSO : Boolean) return Bits_107 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_107 is E : Bits_107; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack108.adb b/gcc/ada/libgnat/s-pack108.adb index 2f37e0ce4cbe..87c8a3372622 100644 --- a/gcc/ada/libgnat/s-pack108.adb +++ b/gcc/ada/libgnat/s-pack108.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_108 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_108 or SetU_108 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_108 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_108 -- @@ -100,9 +106,10 @@ package body System.Pack_108 is N : Natural; Rev_SSO : Boolean) return Bits_108 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_108 is N : Natural; Rev_SSO : Boolean) return Bits_108 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_108 is E : Bits_108; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_108 is E : Bits_108; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack109.adb b/gcc/ada/libgnat/s-pack109.adb index a227b27619e1..278d206df3b0 100644 --- a/gcc/ada/libgnat/s-pack109.adb +++ b/gcc/ada/libgnat/s-pack109.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_109 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_109 -- @@ -85,9 +90,10 @@ package body System.Pack_109 is N : Natural; Rev_SSO : Boolean) return Bits_109 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_109 is E : Bits_109; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack11.adb b/gcc/ada/libgnat/s-pack11.adb index 4b227e9ce27e..61312ce41b4a 100644 --- a/gcc/ada/libgnat/s-pack11.adb +++ b/gcc/ada/libgnat/s-pack11.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_11 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_11 -- @@ -85,9 +90,10 @@ package body System.Pack_11 is N : Natural; Rev_SSO : Boolean) return Bits_11 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_11 is E : Bits_11; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack110.adb b/gcc/ada/libgnat/s-pack110.adb index a6ae71bc5d84..40c588461425 100644 --- a/gcc/ada/libgnat/s-pack110.adb +++ b/gcc/ada/libgnat/s-pack110.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_110 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_110 or SetU_110 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_110 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_110 -- @@ -100,9 +106,10 @@ package body System.Pack_110 is N : Natural; Rev_SSO : Boolean) return Bits_110 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_110 is N : Natural; Rev_SSO : Boolean) return Bits_110 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_110 is E : Bits_110; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_110 is E : Bits_110; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack111.adb b/gcc/ada/libgnat/s-pack111.adb index d0068d26e168..4b4e5b40aa7c 100644 --- a/gcc/ada/libgnat/s-pack111.adb +++ b/gcc/ada/libgnat/s-pack111.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_111 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_111 -- @@ -85,9 +90,10 @@ package body System.Pack_111 is N : Natural; Rev_SSO : Boolean) return Bits_111 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_111 is E : Bits_111; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack112.adb b/gcc/ada/libgnat/s-pack112.adb index fe3b608080dd..16dedbc83352 100644 --- a/gcc/ada/libgnat/s-pack112.adb +++ b/gcc/ada/libgnat/s-pack112.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_112 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_112 or SetU_112 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_112 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_112 -- @@ -100,9 +106,10 @@ package body System.Pack_112 is N : Natural; Rev_SSO : Boolean) return Bits_112 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_112 is N : Natural; Rev_SSO : Boolean) return Bits_112 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_112 is E : Bits_112; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_112 is E : Bits_112; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack113.adb b/gcc/ada/libgnat/s-pack113.adb index 7430264b64d4..4376c2aac402 100644 --- a/gcc/ada/libgnat/s-pack113.adb +++ b/gcc/ada/libgnat/s-pack113.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_113 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_113 -- @@ -85,9 +90,10 @@ package body System.Pack_113 is N : Natural; Rev_SSO : Boolean) return Bits_113 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_113 is E : Bits_113; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack114.adb b/gcc/ada/libgnat/s-pack114.adb index f0bdba210063..7d0d4c6d628b 100644 --- a/gcc/ada/libgnat/s-pack114.adb +++ b/gcc/ada/libgnat/s-pack114.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_114 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_114 or SetU_114 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_114 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_114 -- @@ -100,9 +106,10 @@ package body System.Pack_114 is N : Natural; Rev_SSO : Boolean) return Bits_114 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_114 is N : Natural; Rev_SSO : Boolean) return Bits_114 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_114 is E : Bits_114; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_114 is E : Bits_114; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack115.adb b/gcc/ada/libgnat/s-pack115.adb index ba6448a52eaa..ccca0e730880 100644 --- a/gcc/ada/libgnat/s-pack115.adb +++ b/gcc/ada/libgnat/s-pack115.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_115 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_115 -- @@ -85,9 +90,10 @@ package body System.Pack_115 is N : Natural; Rev_SSO : Boolean) return Bits_115 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_115 is E : Bits_115; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack116.adb b/gcc/ada/libgnat/s-pack116.adb index 9fa7645e166c..4787e6a48b4c 100644 --- a/gcc/ada/libgnat/s-pack116.adb +++ b/gcc/ada/libgnat/s-pack116.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_116 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_116 or SetU_116 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_116 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_116 -- @@ -100,9 +106,10 @@ package body System.Pack_116 is N : Natural; Rev_SSO : Boolean) return Bits_116 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_116 is N : Natural; Rev_SSO : Boolean) return Bits_116 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_116 is E : Bits_116; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_116 is E : Bits_116; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack117.adb b/gcc/ada/libgnat/s-pack117.adb index e9be2444dfe0..b6940d1fa702 100644 --- a/gcc/ada/libgnat/s-pack117.adb +++ b/gcc/ada/libgnat/s-pack117.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_117 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_117 -- @@ -85,9 +90,10 @@ package body System.Pack_117 is N : Natural; Rev_SSO : Boolean) return Bits_117 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_117 is E : Bits_117; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack118.adb b/gcc/ada/libgnat/s-pack118.adb index 4290e0da192c..85aa2d5ec78b 100644 --- a/gcc/ada/libgnat/s-pack118.adb +++ b/gcc/ada/libgnat/s-pack118.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_118 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_118 or SetU_118 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_118 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_118 -- @@ -100,9 +106,10 @@ package body System.Pack_118 is N : Natural; Rev_SSO : Boolean) return Bits_118 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_118 is N : Natural; Rev_SSO : Boolean) return Bits_118 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_118 is E : Bits_118; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_118 is E : Bits_118; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack119.adb b/gcc/ada/libgnat/s-pack119.adb index dd27b4cb1af3..5351727aab82 100644 --- a/gcc/ada/libgnat/s-pack119.adb +++ b/gcc/ada/libgnat/s-pack119.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_119 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_119 -- @@ -85,9 +90,10 @@ package body System.Pack_119 is N : Natural; Rev_SSO : Boolean) return Bits_119 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_119 is E : Bits_119; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack12.adb b/gcc/ada/libgnat/s-pack12.adb index 8ae52d2f791e..6ff08c2cf624 100644 --- a/gcc/ada/libgnat/s-pack12.adb +++ b/gcc/ada/libgnat/s-pack12.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_12 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_12 or SetU_12 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_12 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_12 -- @@ -100,9 +106,10 @@ package body System.Pack_12 is N : Natural; Rev_SSO : Boolean) return Bits_12 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_12 is N : Natural; Rev_SSO : Boolean) return Bits_12 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_12 is E : Bits_12; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_12 is E : Bits_12; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack120.adb b/gcc/ada/libgnat/s-pack120.adb index fdea3afdf2b6..9ba90991874d 100644 --- a/gcc/ada/libgnat/s-pack120.adb +++ b/gcc/ada/libgnat/s-pack120.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_120 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_120 or SetU_120 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_120 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_120 -- @@ -100,9 +106,10 @@ package body System.Pack_120 is N : Natural; Rev_SSO : Boolean) return Bits_120 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_120 is N : Natural; Rev_SSO : Boolean) return Bits_120 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_120 is E : Bits_120; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_120 is E : Bits_120; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack121.adb b/gcc/ada/libgnat/s-pack121.adb index 706801ed038a..c876c8d1ae4b 100644 --- a/gcc/ada/libgnat/s-pack121.adb +++ b/gcc/ada/libgnat/s-pack121.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_121 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_121 -- @@ -85,9 +90,10 @@ package body System.Pack_121 is N : Natural; Rev_SSO : Boolean) return Bits_121 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_121 is E : Bits_121; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack122.adb b/gcc/ada/libgnat/s-pack122.adb index 7ee763f15cb8..b118041c3699 100644 --- a/gcc/ada/libgnat/s-pack122.adb +++ b/gcc/ada/libgnat/s-pack122.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_122 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_122 or SetU_122 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_122 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_122 -- @@ -100,9 +106,10 @@ package body System.Pack_122 is N : Natural; Rev_SSO : Boolean) return Bits_122 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_122 is N : Natural; Rev_SSO : Boolean) return Bits_122 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_122 is E : Bits_122; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_122 is E : Bits_122; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack123.adb b/gcc/ada/libgnat/s-pack123.adb index a26123e0f68c..db6ee28d450d 100644 --- a/gcc/ada/libgnat/s-pack123.adb +++ b/gcc/ada/libgnat/s-pack123.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_123 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_123 -- @@ -85,9 +90,10 @@ package body System.Pack_123 is N : Natural; Rev_SSO : Boolean) return Bits_123 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_123 is E : Bits_123; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack124.adb b/gcc/ada/libgnat/s-pack124.adb index e3f1ae37ad73..8973af14672e 100644 --- a/gcc/ada/libgnat/s-pack124.adb +++ b/gcc/ada/libgnat/s-pack124.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_124 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_124 or SetU_124 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_124 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_124 -- @@ -100,9 +106,10 @@ package body System.Pack_124 is N : Natural; Rev_SSO : Boolean) return Bits_124 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_124 is N : Natural; Rev_SSO : Boolean) return Bits_124 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_124 is E : Bits_124; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_124 is E : Bits_124; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack125.adb b/gcc/ada/libgnat/s-pack125.adb index 86137f6a8e29..cd5e77e6daee 100644 --- a/gcc/ada/libgnat/s-pack125.adb +++ b/gcc/ada/libgnat/s-pack125.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_125 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_125 -- @@ -85,9 +90,10 @@ package body System.Pack_125 is N : Natural; Rev_SSO : Boolean) return Bits_125 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_125 is E : Bits_125; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack126.adb b/gcc/ada/libgnat/s-pack126.adb index a98463948ce9..3aa0b24ddda6 100644 --- a/gcc/ada/libgnat/s-pack126.adb +++ b/gcc/ada/libgnat/s-pack126.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_126 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_126 or SetU_126 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_126 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_126 -- @@ -100,9 +106,10 @@ package body System.Pack_126 is N : Natural; Rev_SSO : Boolean) return Bits_126 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_126 is N : Natural; Rev_SSO : Boolean) return Bits_126 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_126 is E : Bits_126; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_126 is E : Bits_126; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack127.adb b/gcc/ada/libgnat/s-pack127.adb index 2cc704033680..f85591e2ff41 100644 --- a/gcc/ada/libgnat/s-pack127.adb +++ b/gcc/ada/libgnat/s-pack127.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_127 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_127 -- @@ -85,9 +90,10 @@ package body System.Pack_127 is N : Natural; Rev_SSO : Boolean) return Bits_127 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_127 is E : Bits_127; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack13.adb b/gcc/ada/libgnat/s-pack13.adb index 3cb510bfe5b8..0623f9a314ce 100644 --- a/gcc/ada/libgnat/s-pack13.adb +++ b/gcc/ada/libgnat/s-pack13.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_13 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_13 -- @@ -85,9 +90,10 @@ package body System.Pack_13 is N : Natural; Rev_SSO : Boolean) return Bits_13 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_13 is E : Bits_13; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack14.adb b/gcc/ada/libgnat/s-pack14.adb index 56e8ab96d5c2..c769d976f8de 100644 --- a/gcc/ada/libgnat/s-pack14.adb +++ b/gcc/ada/libgnat/s-pack14.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_14 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_14 or SetU_14 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_14 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_14 -- @@ -100,9 +106,10 @@ package body System.Pack_14 is N : Natural; Rev_SSO : Boolean) return Bits_14 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_14 is N : Natural; Rev_SSO : Boolean) return Bits_14 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_14 is E : Bits_14; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_14 is E : Bits_14; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack15.adb b/gcc/ada/libgnat/s-pack15.adb index f4dcc7479a5d..70ff0f11723f 100644 --- a/gcc/ada/libgnat/s-pack15.adb +++ b/gcc/ada/libgnat/s-pack15.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_15 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_15 -- @@ -85,9 +90,10 @@ package body System.Pack_15 is N : Natural; Rev_SSO : Boolean) return Bits_15 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_15 is E : Bits_15; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack17.adb b/gcc/ada/libgnat/s-pack17.adb index fbecd155d68f..5347d0adae4e 100644 --- a/gcc/ada/libgnat/s-pack17.adb +++ b/gcc/ada/libgnat/s-pack17.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_17 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_17 -- @@ -85,9 +90,10 @@ package body System.Pack_17 is N : Natural; Rev_SSO : Boolean) return Bits_17 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_17 is E : Bits_17; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack18.adb b/gcc/ada/libgnat/s-pack18.adb index 0a1939318779..b8a907c1f4bc 100644 --- a/gcc/ada/libgnat/s-pack18.adb +++ b/gcc/ada/libgnat/s-pack18.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_18 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_18 or SetU_18 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_18 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_18 -- @@ -100,9 +106,10 @@ package body System.Pack_18 is N : Natural; Rev_SSO : Boolean) return Bits_18 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_18 is N : Natural; Rev_SSO : Boolean) return Bits_18 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_18 is E : Bits_18; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_18 is E : Bits_18; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack19.adb b/gcc/ada/libgnat/s-pack19.adb index 2fc2c690fdda..5185380326b3 100644 --- a/gcc/ada/libgnat/s-pack19.adb +++ b/gcc/ada/libgnat/s-pack19.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_19 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_19 -- @@ -85,9 +90,10 @@ package body System.Pack_19 is N : Natural; Rev_SSO : Boolean) return Bits_19 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_19 is E : Bits_19; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack20.adb b/gcc/ada/libgnat/s-pack20.adb index 678931df49e1..b5e0a6708968 100644 --- a/gcc/ada/libgnat/s-pack20.adb +++ b/gcc/ada/libgnat/s-pack20.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_20 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_20 or SetU_20 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_20 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_20 -- @@ -100,9 +106,10 @@ package body System.Pack_20 is N : Natural; Rev_SSO : Boolean) return Bits_20 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_20 is N : Natural; Rev_SSO : Boolean) return Bits_20 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_20 is E : Bits_20; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_20 is E : Bits_20; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack21.adb b/gcc/ada/libgnat/s-pack21.adb index b55e835f6665..8b98af8c1884 100644 --- a/gcc/ada/libgnat/s-pack21.adb +++ b/gcc/ada/libgnat/s-pack21.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_21 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_21 -- @@ -85,9 +90,10 @@ package body System.Pack_21 is N : Natural; Rev_SSO : Boolean) return Bits_21 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_21 is E : Bits_21; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack22.adb b/gcc/ada/libgnat/s-pack22.adb index 91cd46f7e101..14e52268741d 100644 --- a/gcc/ada/libgnat/s-pack22.adb +++ b/gcc/ada/libgnat/s-pack22.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_22 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_22 or SetU_22 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_22 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_22 -- @@ -100,9 +106,10 @@ package body System.Pack_22 is N : Natural; Rev_SSO : Boolean) return Bits_22 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_22 is N : Natural; Rev_SSO : Boolean) return Bits_22 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_22 is E : Bits_22; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_22 is E : Bits_22; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack23.adb b/gcc/ada/libgnat/s-pack23.adb index 9dc2450a85b5..7284a1b459a3 100644 --- a/gcc/ada/libgnat/s-pack23.adb +++ b/gcc/ada/libgnat/s-pack23.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_23 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_23 -- @@ -85,9 +90,10 @@ package body System.Pack_23 is N : Natural; Rev_SSO : Boolean) return Bits_23 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_23 is E : Bits_23; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack24.adb b/gcc/ada/libgnat/s-pack24.adb index 27c3c9dc2628..b2c2a620fae5 100644 --- a/gcc/ada/libgnat/s-pack24.adb +++ b/gcc/ada/libgnat/s-pack24.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_24 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_24 or SetU_24 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_24 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_24 -- @@ -100,9 +106,10 @@ package body System.Pack_24 is N : Natural; Rev_SSO : Boolean) return Bits_24 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_24 is N : Natural; Rev_SSO : Boolean) return Bits_24 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_24 is E : Bits_24; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_24 is E : Bits_24; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack25.adb b/gcc/ada/libgnat/s-pack25.adb index 2a6ce35079f9..dd473d292c98 100644 --- a/gcc/ada/libgnat/s-pack25.adb +++ b/gcc/ada/libgnat/s-pack25.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_25 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_25 -- @@ -85,9 +90,10 @@ package body System.Pack_25 is N : Natural; Rev_SSO : Boolean) return Bits_25 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_25 is E : Bits_25; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack26.adb b/gcc/ada/libgnat/s-pack26.adb index f764b482ef65..4a682b5bb0ef 100644 --- a/gcc/ada/libgnat/s-pack26.adb +++ b/gcc/ada/libgnat/s-pack26.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_26 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_26 or SetU_26 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_26 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_26 -- @@ -100,9 +106,10 @@ package body System.Pack_26 is N : Natural; Rev_SSO : Boolean) return Bits_26 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_26 is N : Natural; Rev_SSO : Boolean) return Bits_26 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_26 is E : Bits_26; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_26 is E : Bits_26; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack27.adb b/gcc/ada/libgnat/s-pack27.adb index 23d12b0d91b1..c0bc77109cc4 100644 --- a/gcc/ada/libgnat/s-pack27.adb +++ b/gcc/ada/libgnat/s-pack27.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_27 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_27 -- @@ -85,9 +90,10 @@ package body System.Pack_27 is N : Natural; Rev_SSO : Boolean) return Bits_27 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_27 is E : Bits_27; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack28.adb b/gcc/ada/libgnat/s-pack28.adb index d2c2efb133ec..be27c0eee8a1 100644 --- a/gcc/ada/libgnat/s-pack28.adb +++ b/gcc/ada/libgnat/s-pack28.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_28 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_28 or SetU_28 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_28 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_28 -- @@ -100,9 +106,10 @@ package body System.Pack_28 is N : Natural; Rev_SSO : Boolean) return Bits_28 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_28 is N : Natural; Rev_SSO : Boolean) return Bits_28 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_28 is E : Bits_28; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_28 is E : Bits_28; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack29.adb b/gcc/ada/libgnat/s-pack29.adb index 0212843b6d52..2254b908c007 100644 --- a/gcc/ada/libgnat/s-pack29.adb +++ b/gcc/ada/libgnat/s-pack29.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_29 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_29 -- @@ -85,9 +90,10 @@ package body System.Pack_29 is N : Natural; Rev_SSO : Boolean) return Bits_29 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_29 is E : Bits_29; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack30.adb b/gcc/ada/libgnat/s-pack30.adb index 0f313f31d529..fa48a0a2cfd3 100644 --- a/gcc/ada/libgnat/s-pack30.adb +++ b/gcc/ada/libgnat/s-pack30.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_30 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_30 or SetU_30 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_30 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_30 -- @@ -100,9 +106,10 @@ package body System.Pack_30 is N : Natural; Rev_SSO : Boolean) return Bits_30 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_30 is N : Natural; Rev_SSO : Boolean) return Bits_30 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_30 is E : Bits_30; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_30 is E : Bits_30; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack31.adb b/gcc/ada/libgnat/s-pack31.adb index 958bca77ae26..3234d431efae 100644 --- a/gcc/ada/libgnat/s-pack31.adb +++ b/gcc/ada/libgnat/s-pack31.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_31 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_31 -- @@ -85,9 +90,10 @@ package body System.Pack_31 is N : Natural; Rev_SSO : Boolean) return Bits_31 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_31 is E : Bits_31; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack33.adb b/gcc/ada/libgnat/s-pack33.adb index 6cf9d5cc463f..4b0aae8f002e 100644 --- a/gcc/ada/libgnat/s-pack33.adb +++ b/gcc/ada/libgnat/s-pack33.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_33 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_33 -- @@ -85,9 +90,10 @@ package body System.Pack_33 is N : Natural; Rev_SSO : Boolean) return Bits_33 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_33 is E : Bits_33; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack34.adb b/gcc/ada/libgnat/s-pack34.adb index a63451b65f49..2f8a348ea7c2 100644 --- a/gcc/ada/libgnat/s-pack34.adb +++ b/gcc/ada/libgnat/s-pack34.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_34 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_34 or SetU_34 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_34 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_34 -- @@ -100,9 +106,10 @@ package body System.Pack_34 is N : Natural; Rev_SSO : Boolean) return Bits_34 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_34 is N : Natural; Rev_SSO : Boolean) return Bits_34 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_34 is E : Bits_34; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_34 is E : Bits_34; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack35.adb b/gcc/ada/libgnat/s-pack35.adb index 36d011f37b11..82608e1cd092 100644 --- a/gcc/ada/libgnat/s-pack35.adb +++ b/gcc/ada/libgnat/s-pack35.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_35 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_35 -- @@ -85,9 +90,10 @@ package body System.Pack_35 is N : Natural; Rev_SSO : Boolean) return Bits_35 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_35 is E : Bits_35; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack36.adb b/gcc/ada/libgnat/s-pack36.adb index a137c3beb47d..b39556844240 100644 --- a/gcc/ada/libgnat/s-pack36.adb +++ b/gcc/ada/libgnat/s-pack36.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_36 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_36 or SetU_36 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_36 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_36 -- @@ -100,9 +106,10 @@ package body System.Pack_36 is N : Natural; Rev_SSO : Boolean) return Bits_36 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_36 is N : Natural; Rev_SSO : Boolean) return Bits_36 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_36 is E : Bits_36; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_36 is E : Bits_36; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack37.adb b/gcc/ada/libgnat/s-pack37.adb index 72ec4c63bddf..0f46635120b1 100644 --- a/gcc/ada/libgnat/s-pack37.adb +++ b/gcc/ada/libgnat/s-pack37.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_37 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_37 -- @@ -85,9 +90,10 @@ package body System.Pack_37 is N : Natural; Rev_SSO : Boolean) return Bits_37 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_37 is E : Bits_37; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack38.adb b/gcc/ada/libgnat/s-pack38.adb index 6ea9a67568d2..97303c9aea01 100644 --- a/gcc/ada/libgnat/s-pack38.adb +++ b/gcc/ada/libgnat/s-pack38.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_38 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_38 or SetU_38 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_38 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_38 -- @@ -100,9 +106,10 @@ package body System.Pack_38 is N : Natural; Rev_SSO : Boolean) return Bits_38 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_38 is N : Natural; Rev_SSO : Boolean) return Bits_38 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_38 is E : Bits_38; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_38 is E : Bits_38; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack39.adb b/gcc/ada/libgnat/s-pack39.adb index 75747c5293da..e712ba0b8db8 100644 --- a/gcc/ada/libgnat/s-pack39.adb +++ b/gcc/ada/libgnat/s-pack39.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_39 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_39 -- @@ -85,9 +90,10 @@ package body System.Pack_39 is N : Natural; Rev_SSO : Boolean) return Bits_39 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_39 is E : Bits_39; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack40.adb b/gcc/ada/libgnat/s-pack40.adb index 383c54ebe72a..44d8aa49a32c 100644 --- a/gcc/ada/libgnat/s-pack40.adb +++ b/gcc/ada/libgnat/s-pack40.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_40 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_40 or SetU_40 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_40 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_40 -- @@ -100,9 +106,10 @@ package body System.Pack_40 is N : Natural; Rev_SSO : Boolean) return Bits_40 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_40 is N : Natural; Rev_SSO : Boolean) return Bits_40 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_40 is E : Bits_40; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_40 is E : Bits_40; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack41.adb b/gcc/ada/libgnat/s-pack41.adb index 23849bedc679..cb7378a693c9 100644 --- a/gcc/ada/libgnat/s-pack41.adb +++ b/gcc/ada/libgnat/s-pack41.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_41 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_41 -- @@ -85,9 +90,10 @@ package body System.Pack_41 is N : Natural; Rev_SSO : Boolean) return Bits_41 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_41 is E : Bits_41; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack42.adb b/gcc/ada/libgnat/s-pack42.adb index b90fe0313567..96b388152911 100644 --- a/gcc/ada/libgnat/s-pack42.adb +++ b/gcc/ada/libgnat/s-pack42.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_42 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_42 or SetU_42 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_42 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_42 -- @@ -100,9 +106,10 @@ package body System.Pack_42 is N : Natural; Rev_SSO : Boolean) return Bits_42 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_42 is N : Natural; Rev_SSO : Boolean) return Bits_42 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_42 is E : Bits_42; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_42 is E : Bits_42; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack43.adb b/gcc/ada/libgnat/s-pack43.adb index f97e2a51b1c3..eb59a37fc38a 100644 --- a/gcc/ada/libgnat/s-pack43.adb +++ b/gcc/ada/libgnat/s-pack43.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_43 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_43 -- @@ -85,9 +90,10 @@ package body System.Pack_43 is N : Natural; Rev_SSO : Boolean) return Bits_43 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_43 is E : Bits_43; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack44.adb b/gcc/ada/libgnat/s-pack44.adb index 4f61909534a3..f11db4442338 100644 --- a/gcc/ada/libgnat/s-pack44.adb +++ b/gcc/ada/libgnat/s-pack44.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_44 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_44 or SetU_44 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_44 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_44 -- @@ -100,9 +106,10 @@ package body System.Pack_44 is N : Natural; Rev_SSO : Boolean) return Bits_44 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_44 is N : Natural; Rev_SSO : Boolean) return Bits_44 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_44 is E : Bits_44; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_44 is E : Bits_44; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack45.adb b/gcc/ada/libgnat/s-pack45.adb index d67fbaea767a..a880615389e2 100644 --- a/gcc/ada/libgnat/s-pack45.adb +++ b/gcc/ada/libgnat/s-pack45.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_45 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_45 -- @@ -85,9 +90,10 @@ package body System.Pack_45 is N : Natural; Rev_SSO : Boolean) return Bits_45 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_45 is E : Bits_45; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack46.adb b/gcc/ada/libgnat/s-pack46.adb index e5b86bd15801..586e97a5ff32 100644 --- a/gcc/ada/libgnat/s-pack46.adb +++ b/gcc/ada/libgnat/s-pack46.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_46 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_46 or SetU_46 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_46 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_46 -- @@ -100,9 +106,10 @@ package body System.Pack_46 is N : Natural; Rev_SSO : Boolean) return Bits_46 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_46 is N : Natural; Rev_SSO : Boolean) return Bits_46 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_46 is E : Bits_46; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_46 is E : Bits_46; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack47.adb b/gcc/ada/libgnat/s-pack47.adb index c77105c95f1c..d315c8179736 100644 --- a/gcc/ada/libgnat/s-pack47.adb +++ b/gcc/ada/libgnat/s-pack47.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_47 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_47 -- @@ -85,9 +90,10 @@ package body System.Pack_47 is N : Natural; Rev_SSO : Boolean) return Bits_47 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_47 is E : Bits_47; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack48.adb b/gcc/ada/libgnat/s-pack48.adb index ca6a594d7f75..247af835cf04 100644 --- a/gcc/ada/libgnat/s-pack48.adb +++ b/gcc/ada/libgnat/s-pack48.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_48 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_48 or SetU_48 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_48 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_48 -- @@ -100,9 +106,10 @@ package body System.Pack_48 is N : Natural; Rev_SSO : Boolean) return Bits_48 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_48 is N : Natural; Rev_SSO : Boolean) return Bits_48 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_48 is E : Bits_48; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_48 is E : Bits_48; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack49.adb b/gcc/ada/libgnat/s-pack49.adb index 14b47b447c4d..a054313f4815 100644 --- a/gcc/ada/libgnat/s-pack49.adb +++ b/gcc/ada/libgnat/s-pack49.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_49 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_49 -- @@ -85,9 +90,10 @@ package body System.Pack_49 is N : Natural; Rev_SSO : Boolean) return Bits_49 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_49 is E : Bits_49; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack50.adb b/gcc/ada/libgnat/s-pack50.adb index c748e2b7d424..c03c0cf2053b 100644 --- a/gcc/ada/libgnat/s-pack50.adb +++ b/gcc/ada/libgnat/s-pack50.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_50 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_50 or SetU_50 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_50 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_50 -- @@ -100,9 +106,10 @@ package body System.Pack_50 is N : Natural; Rev_SSO : Boolean) return Bits_50 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_50 is N : Natural; Rev_SSO : Boolean) return Bits_50 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_50 is E : Bits_50; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_50 is E : Bits_50; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack51.adb b/gcc/ada/libgnat/s-pack51.adb index 5c203fa952a6..46abe28e6dad 100644 --- a/gcc/ada/libgnat/s-pack51.adb +++ b/gcc/ada/libgnat/s-pack51.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_51 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_51 -- @@ -85,9 +90,10 @@ package body System.Pack_51 is N : Natural; Rev_SSO : Boolean) return Bits_51 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_51 is E : Bits_51; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack52.adb b/gcc/ada/libgnat/s-pack52.adb index 2aeb2f967ded..6cae3f78112b 100644 --- a/gcc/ada/libgnat/s-pack52.adb +++ b/gcc/ada/libgnat/s-pack52.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_52 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_52 or SetU_52 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_52 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_52 -- @@ -100,9 +106,10 @@ package body System.Pack_52 is N : Natural; Rev_SSO : Boolean) return Bits_52 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_52 is N : Natural; Rev_SSO : Boolean) return Bits_52 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_52 is E : Bits_52; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_52 is E : Bits_52; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack53.adb b/gcc/ada/libgnat/s-pack53.adb index 18e12e2791eb..6a51fa6b2e7c 100644 --- a/gcc/ada/libgnat/s-pack53.adb +++ b/gcc/ada/libgnat/s-pack53.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_53 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_53 -- @@ -85,9 +90,10 @@ package body System.Pack_53 is N : Natural; Rev_SSO : Boolean) return Bits_53 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_53 is E : Bits_53; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack54.adb b/gcc/ada/libgnat/s-pack54.adb index 23ec58efb3e4..2cc4e9cfb880 100644 --- a/gcc/ada/libgnat/s-pack54.adb +++ b/gcc/ada/libgnat/s-pack54.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_54 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_54 or SetU_54 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_54 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_54 -- @@ -100,9 +106,10 @@ package body System.Pack_54 is N : Natural; Rev_SSO : Boolean) return Bits_54 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_54 is N : Natural; Rev_SSO : Boolean) return Bits_54 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_54 is E : Bits_54; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_54 is E : Bits_54; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack55.adb b/gcc/ada/libgnat/s-pack55.adb index 3734f1a201c5..b1264c74b4d6 100644 --- a/gcc/ada/libgnat/s-pack55.adb +++ b/gcc/ada/libgnat/s-pack55.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_55 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_55 -- @@ -85,9 +90,10 @@ package body System.Pack_55 is N : Natural; Rev_SSO : Boolean) return Bits_55 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_55 is E : Bits_55; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack56.adb b/gcc/ada/libgnat/s-pack56.adb index 821f206b4934..100b34895a0a 100644 --- a/gcc/ada/libgnat/s-pack56.adb +++ b/gcc/ada/libgnat/s-pack56.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_56 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_56 or SetU_56 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_56 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_56 -- @@ -100,9 +106,10 @@ package body System.Pack_56 is N : Natural; Rev_SSO : Boolean) return Bits_56 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_56 is N : Natural; Rev_SSO : Boolean) return Bits_56 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_56 is E : Bits_56; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_56 is E : Bits_56; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack57.adb b/gcc/ada/libgnat/s-pack57.adb index e490b4d723e0..1056212b8d29 100644 --- a/gcc/ada/libgnat/s-pack57.adb +++ b/gcc/ada/libgnat/s-pack57.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_57 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_57 -- @@ -85,9 +90,10 @@ package body System.Pack_57 is N : Natural; Rev_SSO : Boolean) return Bits_57 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_57 is E : Bits_57; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack58.adb b/gcc/ada/libgnat/s-pack58.adb index 383a278e3d04..c429d38d3b48 100644 --- a/gcc/ada/libgnat/s-pack58.adb +++ b/gcc/ada/libgnat/s-pack58.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_58 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_58 or SetU_58 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_58 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_58 -- @@ -100,9 +106,10 @@ package body System.Pack_58 is N : Natural; Rev_SSO : Boolean) return Bits_58 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_58 is N : Natural; Rev_SSO : Boolean) return Bits_58 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_58 is E : Bits_58; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_58 is E : Bits_58; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack59.adb b/gcc/ada/libgnat/s-pack59.adb index 56fb6814bff9..fe304b96d377 100644 --- a/gcc/ada/libgnat/s-pack59.adb +++ b/gcc/ada/libgnat/s-pack59.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_59 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_59 -- @@ -85,9 +90,10 @@ package body System.Pack_59 is N : Natural; Rev_SSO : Boolean) return Bits_59 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_59 is E : Bits_59; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack60.adb b/gcc/ada/libgnat/s-pack60.adb index d7c0bbff3960..1d1422b7bcd7 100644 --- a/gcc/ada/libgnat/s-pack60.adb +++ b/gcc/ada/libgnat/s-pack60.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_60 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_60 or SetU_60 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_60 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_60 -- @@ -100,9 +106,10 @@ package body System.Pack_60 is N : Natural; Rev_SSO : Boolean) return Bits_60 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_60 is N : Natural; Rev_SSO : Boolean) return Bits_60 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_60 is E : Bits_60; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_60 is E : Bits_60; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack61.adb b/gcc/ada/libgnat/s-pack61.adb index ad15710d677e..d744ff34b9bc 100644 --- a/gcc/ada/libgnat/s-pack61.adb +++ b/gcc/ada/libgnat/s-pack61.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_61 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_61 -- @@ -85,9 +90,10 @@ package body System.Pack_61 is N : Natural; Rev_SSO : Boolean) return Bits_61 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_61 is E : Bits_61; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack62.adb b/gcc/ada/libgnat/s-pack62.adb index 51064af24f4c..d4745cfa2828 100644 --- a/gcc/ada/libgnat/s-pack62.adb +++ b/gcc/ada/libgnat/s-pack62.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_62 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_62 or SetU_62 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_62 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_62 -- @@ -100,9 +106,10 @@ package body System.Pack_62 is N : Natural; Rev_SSO : Boolean) return Bits_62 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_62 is N : Natural; Rev_SSO : Boolean) return Bits_62 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_62 is E : Bits_62; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_62 is E : Bits_62; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack63.adb b/gcc/ada/libgnat/s-pack63.adb index 27f233290b74..257fbabb33c3 100644 --- a/gcc/ada/libgnat/s-pack63.adb +++ b/gcc/ada/libgnat/s-pack63.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_63 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_63 -- @@ -85,9 +90,10 @@ package body System.Pack_63 is N : Natural; Rev_SSO : Boolean) return Bits_63 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_63 is E : Bits_63; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack65.adb b/gcc/ada/libgnat/s-pack65.adb index 00e702159ba4..205b911a5ca9 100644 --- a/gcc/ada/libgnat/s-pack65.adb +++ b/gcc/ada/libgnat/s-pack65.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_65 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_65 -- @@ -85,9 +90,10 @@ package body System.Pack_65 is N : Natural; Rev_SSO : Boolean) return Bits_65 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_65 is E : Bits_65; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack66.adb b/gcc/ada/libgnat/s-pack66.adb index 20cebc9d0981..cb95338d8584 100644 --- a/gcc/ada/libgnat/s-pack66.adb +++ b/gcc/ada/libgnat/s-pack66.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_66 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_66 or SetU_66 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_66 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_66 -- @@ -100,9 +106,10 @@ package body System.Pack_66 is N : Natural; Rev_SSO : Boolean) return Bits_66 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_66 is N : Natural; Rev_SSO : Boolean) return Bits_66 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_66 is E : Bits_66; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_66 is E : Bits_66; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack67.adb b/gcc/ada/libgnat/s-pack67.adb index 9b5accff5a47..194510a1e32e 100644 --- a/gcc/ada/libgnat/s-pack67.adb +++ b/gcc/ada/libgnat/s-pack67.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_67 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_67 -- @@ -85,9 +90,10 @@ package body System.Pack_67 is N : Natural; Rev_SSO : Boolean) return Bits_67 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_67 is E : Bits_67; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack68.adb b/gcc/ada/libgnat/s-pack68.adb index b23bf889a119..cf7043dcc0b9 100644 --- a/gcc/ada/libgnat/s-pack68.adb +++ b/gcc/ada/libgnat/s-pack68.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_68 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_68 or SetU_68 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_68 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_68 -- @@ -100,9 +106,10 @@ package body System.Pack_68 is N : Natural; Rev_SSO : Boolean) return Bits_68 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_68 is N : Natural; Rev_SSO : Boolean) return Bits_68 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_68 is E : Bits_68; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_68 is E : Bits_68; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack69.adb b/gcc/ada/libgnat/s-pack69.adb index e4ab9e5d6f3b..670e6129d86c 100644 --- a/gcc/ada/libgnat/s-pack69.adb +++ b/gcc/ada/libgnat/s-pack69.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_69 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_69 -- @@ -85,9 +90,10 @@ package body System.Pack_69 is N : Natural; Rev_SSO : Boolean) return Bits_69 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_69 is E : Bits_69; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack70.adb b/gcc/ada/libgnat/s-pack70.adb index 9432384e44ef..aa320f67ae11 100644 --- a/gcc/ada/libgnat/s-pack70.adb +++ b/gcc/ada/libgnat/s-pack70.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_70 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_70 or SetU_70 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_70 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_70 -- @@ -100,9 +106,10 @@ package body System.Pack_70 is N : Natural; Rev_SSO : Boolean) return Bits_70 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_70 is N : Natural; Rev_SSO : Boolean) return Bits_70 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_70 is E : Bits_70; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_70 is E : Bits_70; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack71.adb b/gcc/ada/libgnat/s-pack71.adb index bfc75d2da6db..748a1c6b3818 100644 --- a/gcc/ada/libgnat/s-pack71.adb +++ b/gcc/ada/libgnat/s-pack71.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_71 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_71 -- @@ -85,9 +90,10 @@ package body System.Pack_71 is N : Natural; Rev_SSO : Boolean) return Bits_71 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_71 is E : Bits_71; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack72.adb b/gcc/ada/libgnat/s-pack72.adb index 1b22c6b81ecb..b2c463a04e63 100644 --- a/gcc/ada/libgnat/s-pack72.adb +++ b/gcc/ada/libgnat/s-pack72.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_72 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_72 or SetU_72 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_72 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_72 -- @@ -100,9 +106,10 @@ package body System.Pack_72 is N : Natural; Rev_SSO : Boolean) return Bits_72 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_72 is N : Natural; Rev_SSO : Boolean) return Bits_72 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_72 is E : Bits_72; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_72 is E : Bits_72; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack73.adb b/gcc/ada/libgnat/s-pack73.adb index a2e734581e12..3abaebe48085 100644 --- a/gcc/ada/libgnat/s-pack73.adb +++ b/gcc/ada/libgnat/s-pack73.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_73 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_73 -- @@ -85,9 +90,10 @@ package body System.Pack_73 is N : Natural; Rev_SSO : Boolean) return Bits_73 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_73 is E : Bits_73; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack74.adb b/gcc/ada/libgnat/s-pack74.adb index d1f772fecf15..2fe64bc89578 100644 --- a/gcc/ada/libgnat/s-pack74.adb +++ b/gcc/ada/libgnat/s-pack74.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_74 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_74 or SetU_74 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_74 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_74 -- @@ -100,9 +106,10 @@ package body System.Pack_74 is N : Natural; Rev_SSO : Boolean) return Bits_74 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_74 is N : Natural; Rev_SSO : Boolean) return Bits_74 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_74 is E : Bits_74; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_74 is E : Bits_74; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack75.adb b/gcc/ada/libgnat/s-pack75.adb index af38ad355279..d62afc9dec67 100644 --- a/gcc/ada/libgnat/s-pack75.adb +++ b/gcc/ada/libgnat/s-pack75.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_75 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_75 -- @@ -85,9 +90,10 @@ package body System.Pack_75 is N : Natural; Rev_SSO : Boolean) return Bits_75 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_75 is E : Bits_75; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack76.adb b/gcc/ada/libgnat/s-pack76.adb index d043013c9aec..30c15964f47f 100644 --- a/gcc/ada/libgnat/s-pack76.adb +++ b/gcc/ada/libgnat/s-pack76.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_76 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_76 or SetU_76 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_76 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_76 -- @@ -100,9 +106,10 @@ package body System.Pack_76 is N : Natural; Rev_SSO : Boolean) return Bits_76 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_76 is N : Natural; Rev_SSO : Boolean) return Bits_76 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_76 is E : Bits_76; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_76 is E : Bits_76; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack77.adb b/gcc/ada/libgnat/s-pack77.adb index 28a971ab8d24..eadc77987ba5 100644 --- a/gcc/ada/libgnat/s-pack77.adb +++ b/gcc/ada/libgnat/s-pack77.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_77 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_77 -- @@ -85,9 +90,10 @@ package body System.Pack_77 is N : Natural; Rev_SSO : Boolean) return Bits_77 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_77 is E : Bits_77; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack78.adb b/gcc/ada/libgnat/s-pack78.adb index 6cbb11f36eff..e5f1896f245b 100644 --- a/gcc/ada/libgnat/s-pack78.adb +++ b/gcc/ada/libgnat/s-pack78.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_78 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_78 or SetU_78 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_78 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_78 -- @@ -100,9 +106,10 @@ package body System.Pack_78 is N : Natural; Rev_SSO : Boolean) return Bits_78 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_78 is N : Natural; Rev_SSO : Boolean) return Bits_78 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_78 is E : Bits_78; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_78 is E : Bits_78; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack79.adb b/gcc/ada/libgnat/s-pack79.adb index 0653f4acdfcb..f2e52afd8cc5 100644 --- a/gcc/ada/libgnat/s-pack79.adb +++ b/gcc/ada/libgnat/s-pack79.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_79 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_79 -- @@ -85,9 +90,10 @@ package body System.Pack_79 is N : Natural; Rev_SSO : Boolean) return Bits_79 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_79 is E : Bits_79; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack80.adb b/gcc/ada/libgnat/s-pack80.adb index 8df62bea370b..8668ad0200be 100644 --- a/gcc/ada/libgnat/s-pack80.adb +++ b/gcc/ada/libgnat/s-pack80.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_80 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_80 or SetU_80 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_80 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_80 -- @@ -100,9 +106,10 @@ package body System.Pack_80 is N : Natural; Rev_SSO : Boolean) return Bits_80 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_80 is N : Natural; Rev_SSO : Boolean) return Bits_80 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_80 is E : Bits_80; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_80 is E : Bits_80; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack81.adb b/gcc/ada/libgnat/s-pack81.adb index e1c308da18a5..210073456761 100644 --- a/gcc/ada/libgnat/s-pack81.adb +++ b/gcc/ada/libgnat/s-pack81.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_81 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_81 -- @@ -85,9 +90,10 @@ package body System.Pack_81 is N : Natural; Rev_SSO : Boolean) return Bits_81 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_81 is E : Bits_81; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack82.adb b/gcc/ada/libgnat/s-pack82.adb index c87a867e6311..9e405a0cc2e8 100644 --- a/gcc/ada/libgnat/s-pack82.adb +++ b/gcc/ada/libgnat/s-pack82.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_82 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_82 or SetU_82 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_82 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_82 -- @@ -100,9 +106,10 @@ package body System.Pack_82 is N : Natural; Rev_SSO : Boolean) return Bits_82 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_82 is N : Natural; Rev_SSO : Boolean) return Bits_82 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_82 is E : Bits_82; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_82 is E : Bits_82; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack83.adb b/gcc/ada/libgnat/s-pack83.adb index 12e67be46f79..49420e6c0f76 100644 --- a/gcc/ada/libgnat/s-pack83.adb +++ b/gcc/ada/libgnat/s-pack83.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_83 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_83 -- @@ -85,9 +90,10 @@ package body System.Pack_83 is N : Natural; Rev_SSO : Boolean) return Bits_83 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_83 is E : Bits_83; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack84.adb b/gcc/ada/libgnat/s-pack84.adb index 996ab787ba9a..a3511943cc92 100644 --- a/gcc/ada/libgnat/s-pack84.adb +++ b/gcc/ada/libgnat/s-pack84.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_84 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_84 or SetU_84 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_84 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_84 -- @@ -100,9 +106,10 @@ package body System.Pack_84 is N : Natural; Rev_SSO : Boolean) return Bits_84 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_84 is N : Natural; Rev_SSO : Boolean) return Bits_84 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_84 is E : Bits_84; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_84 is E : Bits_84; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack85.adb b/gcc/ada/libgnat/s-pack85.adb index 9d62d1c0632e..b700e2e2a6ff 100644 --- a/gcc/ada/libgnat/s-pack85.adb +++ b/gcc/ada/libgnat/s-pack85.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_85 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_85 -- @@ -85,9 +90,10 @@ package body System.Pack_85 is N : Natural; Rev_SSO : Boolean) return Bits_85 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_85 is E : Bits_85; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack86.adb b/gcc/ada/libgnat/s-pack86.adb index b34b58be4b0c..3bf32d47eff3 100644 --- a/gcc/ada/libgnat/s-pack86.adb +++ b/gcc/ada/libgnat/s-pack86.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_86 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_86 or SetU_86 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_86 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_86 -- @@ -100,9 +106,10 @@ package body System.Pack_86 is N : Natural; Rev_SSO : Boolean) return Bits_86 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_86 is N : Natural; Rev_SSO : Boolean) return Bits_86 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_86 is E : Bits_86; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_86 is E : Bits_86; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack87.adb b/gcc/ada/libgnat/s-pack87.adb index 37b0e3462c71..23e460b8e8e4 100644 --- a/gcc/ada/libgnat/s-pack87.adb +++ b/gcc/ada/libgnat/s-pack87.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_87 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_87 -- @@ -85,9 +90,10 @@ package body System.Pack_87 is N : Natural; Rev_SSO : Boolean) return Bits_87 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_87 is E : Bits_87; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack88.adb b/gcc/ada/libgnat/s-pack88.adb index 0bda1593c88c..a17f24840021 100644 --- a/gcc/ada/libgnat/s-pack88.adb +++ b/gcc/ada/libgnat/s-pack88.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_88 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_88 or SetU_88 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_88 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_88 -- @@ -100,9 +106,10 @@ package body System.Pack_88 is N : Natural; Rev_SSO : Boolean) return Bits_88 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_88 is N : Natural; Rev_SSO : Boolean) return Bits_88 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_88 is E : Bits_88; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_88 is E : Bits_88; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack89.adb b/gcc/ada/libgnat/s-pack89.adb index 7d5a9245f2ae..323005c8e2ce 100644 --- a/gcc/ada/libgnat/s-pack89.adb +++ b/gcc/ada/libgnat/s-pack89.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_89 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_89 -- @@ -85,9 +90,10 @@ package body System.Pack_89 is N : Natural; Rev_SSO : Boolean) return Bits_89 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_89 is E : Bits_89; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack90.adb b/gcc/ada/libgnat/s-pack90.adb index 03a402291e60..badcd3fb668f 100644 --- a/gcc/ada/libgnat/s-pack90.adb +++ b/gcc/ada/libgnat/s-pack90.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_90 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_90 or SetU_90 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_90 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_90 -- @@ -100,9 +106,10 @@ package body System.Pack_90 is N : Natural; Rev_SSO : Boolean) return Bits_90 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_90 is N : Natural; Rev_SSO : Boolean) return Bits_90 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_90 is E : Bits_90; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_90 is E : Bits_90; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack91.adb b/gcc/ada/libgnat/s-pack91.adb index b6ccbbfef119..5233fdaf54ca 100644 --- a/gcc/ada/libgnat/s-pack91.adb +++ b/gcc/ada/libgnat/s-pack91.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_91 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_91 -- @@ -85,9 +90,10 @@ package body System.Pack_91 is N : Natural; Rev_SSO : Boolean) return Bits_91 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_91 is E : Bits_91; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack92.adb b/gcc/ada/libgnat/s-pack92.adb index e783869a9bcc..32f7aef3b1d8 100644 --- a/gcc/ada/libgnat/s-pack92.adb +++ b/gcc/ada/libgnat/s-pack92.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_92 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_92 or SetU_92 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_92 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_92 -- @@ -100,9 +106,10 @@ package body System.Pack_92 is N : Natural; Rev_SSO : Boolean) return Bits_92 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_92 is N : Natural; Rev_SSO : Boolean) return Bits_92 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_92 is E : Bits_92; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_92 is E : Bits_92; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack93.adb b/gcc/ada/libgnat/s-pack93.adb index 83be8504c4df..079b1bec4a9f 100644 --- a/gcc/ada/libgnat/s-pack93.adb +++ b/gcc/ada/libgnat/s-pack93.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_93 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_93 -- @@ -85,9 +90,10 @@ package body System.Pack_93 is N : Natural; Rev_SSO : Boolean) return Bits_93 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_93 is E : Bits_93; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack94.adb b/gcc/ada/libgnat/s-pack94.adb index 1ad7e544c8a7..0964b3787372 100644 --- a/gcc/ada/libgnat/s-pack94.adb +++ b/gcc/ada/libgnat/s-pack94.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_94 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_94 or SetU_94 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_94 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_94 -- @@ -100,9 +106,10 @@ package body System.Pack_94 is N : Natural; Rev_SSO : Boolean) return Bits_94 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_94 is N : Natural; Rev_SSO : Boolean) return Bits_94 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_94 is E : Bits_94; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_94 is E : Bits_94; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack95.adb b/gcc/ada/libgnat/s-pack95.adb index aeca0c65f533..c81c259b0514 100644 --- a/gcc/ada/libgnat/s-pack95.adb +++ b/gcc/ada/libgnat/s-pack95.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_95 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_95 -- @@ -85,9 +90,10 @@ package body System.Pack_95 is N : Natural; Rev_SSO : Boolean) return Bits_95 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_95 is E : Bits_95; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack96.adb b/gcc/ada/libgnat/s-pack96.adb index 4ed75c7fa501..47bc025d8299 100644 --- a/gcc/ada/libgnat/s-pack96.adb +++ b/gcc/ada/libgnat/s-pack96.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_96 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_96 or SetU_96 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_96 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_96 -- @@ -100,9 +106,10 @@ package body System.Pack_96 is N : Natural; Rev_SSO : Boolean) return Bits_96 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_96 is N : Natural; Rev_SSO : Boolean) return Bits_96 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_96 is E : Bits_96; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_96 is E : Bits_96; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack97.adb b/gcc/ada/libgnat/s-pack97.adb index 316780e1efeb..737fc0f9a345 100644 --- a/gcc/ada/libgnat/s-pack97.adb +++ b/gcc/ada/libgnat/s-pack97.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_97 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_97 -- @@ -85,9 +90,10 @@ package body System.Pack_97 is N : Natural; Rev_SSO : Boolean) return Bits_97 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_97 is E : Bits_97; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack98.adb b/gcc/ada/libgnat/s-pack98.adb index b1c9074624bf..f6d3264d374a 100644 --- a/gcc/ada/libgnat/s-pack98.adb +++ b/gcc/ada/libgnat/s-pack98.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_98 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); -- The following declarations are for the case where the address -- passed to GetU_98 or SetU_98 is not guaranteed to be aligned. @@ -84,12 +89,13 @@ package body System.Pack_98 is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); ------------ -- Get_98 -- @@ -100,9 +106,10 @@ package body System.Pack_98 is N : Natural; Rev_SSO : Boolean) return Bits_98 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -138,9 +145,10 @@ package body System.Pack_98 is N : Natural; Rev_SSO : Boolean) return Bits_98 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -177,9 +185,10 @@ package body System.Pack_98 is E : Bits_98; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -216,9 +225,10 @@ package body System.Pack_98 is E : Bits_98; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/libgnat/s-pack99.adb b/gcc/ada/libgnat/s-pack99.adb index 08e07262a7c4..9cc57f10128b 100644 --- a/gcc/ada/libgnat/s-pack99.adb +++ b/gcc/ada/libgnat/s-pack99.adb @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_99 is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); ------------ -- Get_99 -- @@ -85,9 +90,10 @@ package body System.Pack_99 is N : Natural; Rev_SSO : Boolean) return Bits_99 is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -124,9 +130,10 @@ package body System.Pack_99 is E : Bits_99; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is diff --git a/gcc/ada/s-pack.adb.tmpl b/gcc/ada/s-pack.adb.tmpl index 69da423016a1..540c5196534a 100644 --- a/gcc/ada/s-pack.adb.tmpl +++ b/gcc/ada/s-pack.adb.tmpl @@ -29,6 +29,7 @@ -- -- ------------------------------------------------------------------------------ +with System.Address_To_Access_Conversions; with System.Storage_Elements; with System.Unsigned_Types; @@ -69,12 +70,16 @@ package body System.Pack_@@ is -- Use maximum possible alignment, given the bit field size, since this -- will result in the most efficient code possible for the field. - type Cluster_Ref is access Cluster; + package AAC is new Address_To_Access_Conversions (Cluster); + -- We convert addresses to access values and dereference them instead of + -- directly using overlays in order to work around the implementation of + -- the RM 13.3(19) clause, which would pessimize the generated code. type Rev_Cluster is new Cluster with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_Cluster_Ref is access Rev_Cluster; + + package Rev_AAC is new Address_To_Access_Conversions (Rev_Cluster); @even -- The following declarations are for the case where the address @@ -85,12 +90,13 @@ package body System.Pack_@@ is type ClusterU is new Cluster; for ClusterU'Alignment use 1; - type ClusterU_Ref is access ClusterU; + package AACU is new Address_To_Access_Conversions (ClusterU); type Rev_ClusterU is new ClusterU with Bit_Order => Reverse_Bit_Order, Scalar_Storage_Order => Reverse_Bit_Order; - type Rev_ClusterU_Ref is access Rev_ClusterU; + + package Rev_AACU is new Address_To_Access_Conversions (Rev_ClusterU); @/even ------------ @@ -102,9 +108,10 @@ package body System.Pack_@@ is N : Natural; Rev_SSO : Boolean) return Bits_@@ is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin return (if Rev_SSO then @@ -141,9 +148,10 @@ package body System.Pack_@@ is N : Natural; Rev_SSO : Boolean) return Bits_@@ is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin return (if Rev_SSO then @@ -181,9 +189,10 @@ package body System.Pack_@@ is E : Bits_@@; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : Cluster_Ref with Address => A'Address, Import; - RC : Rev_Cluster_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AAC.Object_Pointer := AAC.To_Pointer (A); + RC : constant Rev_AAC.Object_Pointer := Rev_AAC.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is @@ -221,9 +230,10 @@ package body System.Pack_@@ is E : Bits_@@; Rev_SSO : Boolean) is - A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); - C : ClusterU_Ref with Address => A'Address, Import; - RC : Rev_ClusterU_Ref with Address => A'Address, Import; + A : constant System.Address := Arr + Bits * Ofs (Uns (N) / 8); + C : constant AACU.Object_Pointer := AACU.To_Pointer (A); + RC : constant Rev_AACU.Object_Pointer := Rev_AACU.To_Pointer (A); + begin if Rev_SSO then case N07 (Uns (N) mod 8) is -- 2.47.3