]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Pass unaligned record components by copy in calls on all platforms
authorEric Botcazou <ebotcazou@adacore.com>
Tue, 20 Aug 2024 20:59:58 +0000 (22:59 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 3 Sep 2024 08:16:47 +0000 (10:16 +0200)
This has historically been done only on platforms requiring the strict
alignment of memory references, but this can arguably be considered as
being mandated by the language on all of them.

gcc/ada/

* gcc-interface/trans.cc (addressable_p) <COMPONENT_REF>: Take into
account the alignment of the field on all platforms.

gcc/ada/gcc-interface/trans.cc

index 3f2eadd7b2bc42e1a4d2c1ba6a53b74bcddf8c56..7cced04361d0893c884732768b35a7d9a4710d57 100644 (file)
@@ -10289,9 +10289,8 @@ addressable_p (tree gnu_expr, tree gnu_type)
                   check the alignment of the containing record, as it is
                   guaranteed to be not smaller than that of its most
                   aligned field that is not a bit-field.  */
-               && (!STRICT_ALIGNMENT
-                   || DECL_ALIGN (TREE_OPERAND (gnu_expr, 1))
-                      >= TYPE_ALIGN (TREE_TYPE (gnu_expr))))
+               && DECL_ALIGN (TREE_OPERAND (gnu_expr, 1))
+                  >= TYPE_ALIGN (TREE_TYPE (gnu_expr)))
               /* The field of a padding record is always addressable.  */
               || TYPE_IS_PADDING_P (TREE_TYPE (TREE_OPERAND (gnu_expr, 0))))
              && addressable_p (TREE_OPERAND (gnu_expr, 0), NULL_TREE));