]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix gimplification of ordering comparisons of arrays of bytes
authorEric Botcazou <ebotcazou@adacore.com>
Thu, 11 Jul 2024 08:49:13 +0000 (10:49 +0200)
committerEric Botcazou <ebotcazou@adacore.com>
Thu, 11 Jul 2024 11:40:24 +0000 (13:40 +0200)
commit738711703db9f42490f06211a3e8fba07a84dbce
tree2321b940a692b213d26721d65c67c6dd9292e538
parent077f16b249346b560169cf89849779272327a2da
Fix gimplification of ordering comparisons of arrays of bytes

The Ada compiler now defers to the gimplifier for ordering comparisons of
arrays of bytes (Ada parlance for <, >, <= and >=) because the gimplifier
in turn defers to memcmp for them, which implements the required semantics.

However, the gimplifier has a special processing for aggregate types whose
mode is not BLKmode and this processing deviates from the memcmp semantics
when the target is little-endian.

gcc/
* gimplify.cc (gimplify_scalar_mode_aggregate_compare): Add support
for ordering comparisons.
(gimplify_expr) <default>: Call gimplify_scalar_mode_aggregate_compare
only for integral scalar modes.

gcc/testsuite/
* gnat.dg/array42.adb, gnat.dg/array42_pkg.ads: New test.
gcc/gimplify.cc
gcc/testsuite/gnat.dg/array42.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/array42_pkg.ads [new file with mode: 0644]