aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-08-23 17:06:00 +0200
committerMarc Poulhiès <dkm@gcc.gnu.org>2024-09-03 10:16:54 +0200
commita19cf635ea29658d5f9fc19199473d6d823ef2d1 (patch)
treeb09534236f5344e40279486b1711005991104875
parent9362abf5e81eb2e6e35f55f36ff8e7a31aef4e9d (diff)
downloadgcc-a19cf635ea29658d5f9fc19199473d6d823ef2d1.zip
gcc-a19cf635ea29658d5f9fc19199473d6d823ef2d1.tar.gz
gcc-a19cf635ea29658d5f9fc19199473d6d823ef2d1.tar.bz2
ada: Add kludge for quirk of ancient 32-bit ABIs to previous change
Some ancient 32-bit ABIs, most notably that of x86/Linux, misalign double scalars in record types, so comparing DECL_ALIGN with TYPE_ALIGN directly may give the wrong answer for them. gcc/ada/ * gcc-interface/trans.cc (addressable_p) <COMPONENT_REF>: Add kludge to cope with ancient 32-bit ABIs.
-rw-r--r--gcc/ada/gcc-interface/trans.cc16
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/ada/gcc-interface/trans.cc b/gcc/ada/gcc-interface/trans.cc
index fadd6b4..c99b066 100644
--- a/gcc/ada/gcc-interface/trans.cc
+++ b/gcc/ada/gcc-interface/trans.cc
@@ -10294,8 +10294,20 @@ 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. */
- && 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))
+#ifdef TARGET_ALIGN_DOUBLE
+ /* Cope with the misalignment of doubles in records for
+ ancient 32-bit ABIs like that of x86/Linux. */
+ || (DECL_ALIGN (TREE_OPERAND (gnu_expr, 1)) == 32
+ && TYPE_ALIGN (TREE_TYPE (gnu_expr)) == 64
+ && !TARGET_ALIGN_DOUBLE
+#ifdef TARGET_64BIT
+ && !TARGET_64BIT
+#endif
+ )
+#endif
+ ))
/* 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));