From d7815fc4509e0caf04c4b43de89b20ac57504307 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sat, 17 Nov 2018 11:01:00 +0000 Subject: [PATCH] Fix wrong alignment returned by .alignof property. The D language expects the value to be the minimum alignment required for the type, not the preferred alignment. gcc/d/ChangeLog: 2018-11-17 Iain Buclaw PR d/87824 * d-target.cc (Target::alignsize): Return min_align_of_type. From-SVN: r266234 --- gcc/d/ChangeLog | 5 +++++ gcc/d/d-target.cc | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index d534f36bb3f..c706d085a3e 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,8 @@ +2018-11-17 Iain Buclaw + + PR d/87824 + * d-target.cc (Target::alignsize): Return min_align_of_type. + 2018-11-05 Iain Buclaw PR d/87865 diff --git a/gcc/d/d-target.cc b/gcc/d/d-target.cc index 3ae791b5f70..86b042938af 100644 --- a/gcc/d/d-target.cc +++ b/gcc/d/d-target.cc @@ -189,7 +189,7 @@ unsigned Target::alignsize (Type *type) { gcc_assert (type->isTypeBasic ()); - return TYPE_ALIGN_UNIT (build_ctype (type)); + return min_align_of_type (build_ctype (type)); } /* Return GCC field alignment size for type TYPE. */ -- 2.30.2