diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2022-11-22 19:03:49 +0100 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2022-11-22 19:04:58 +0100 |
commit | 55cb8c5c9abfe83c342a7b8e8b7dd4bee1791302 (patch) | |
tree | 643d1a2b25dd6ece3f251992e73e9f90be3af7bf /gcc/testsuite/gnat.dg | |
parent | dfc1ea414e0cebccfcffc771ebcefa3d24c9754c (diff) | |
download | gcc-55cb8c5c9abfe83c342a7b8e8b7dd4bee1791302.zip gcc-55cb8c5c9abfe83c342a7b8e8b7dd4bee1791302.tar.gz gcc-55cb8c5c9abfe83c342a7b8e8b7dd4bee1791302.tar.bz2 |
Fix wrong array type conversion with different storage orde
When two arrays of scalars have a different storage order in Ada, the
front-end makes sure that the conversion is performed component-wise
so that each component can be reversed. So it's a little bit counter
productive that the ldist pass performs the opposite transformation
and synthesizes a memcpy/memmove in this case.
gcc/
* tree-loop-distribution.cc (loop_distribution::classify_builtin_ldst):
Bail out if source and destination do not have the same storage order.
gcc/testsuite/
* gnat.dg/sso18.adb: New test.
Diffstat (limited to 'gcc/testsuite/gnat.dg')
-rw-r--r-- | gcc/testsuite/gnat.dg/sso18.adb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/sso18.adb b/gcc/testsuite/gnat.dg/sso18.adb new file mode 100644 index 0000000..7496e96 --- /dev/null +++ b/gcc/testsuite/gnat.dg/sso18.adb @@ -0,0 +1,21 @@ +-- { dg-do run } +-- { dg-options "-O2" } + +with System; + +procedure SSO18 is + + type Arr is array (1..32) of Short_Integer; + type Rev_Arr is array (1..32) of Short_Integer + with Scalar_Storage_Order => System.High_Order_First; + C : constant Arr := (others => 16); + RA : Rev_Arr; + A : Arr; + +begin + RA := Rev_Arr(C); + A := Arr (RA); + if A /= C or else RA(1) /= 16 then + raise Program_Error; + end if; +end; |