Fix wrong alignment returned by .alignof property.
authorIain Buclaw <ibuclaw@gdcproject.org>
Sat, 17 Nov 2018 11:01:00 +0000 (11:01 +0000)
committerIain Buclaw <ibuclaw@gcc.gnu.org>
Sat, 17 Nov 2018 11:01:00 +0000 (11:01 +0000)
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  <ibuclaw@gdcproject.org>

PR d/87824
* d-target.cc (Target::alignsize): Return min_align_of_type.

From-SVN: r266234

gcc/d/ChangeLog
gcc/d/d-target.cc

index d534f36bb3f8568431105a4dd0bdff6c32a0b580..c706d085a3eb8dfd0b4743a4ec200e2ef229995d 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-17  Iain Buclaw  <ibuclaw@gdcproject.org>
+
+       PR d/87824
+       * d-target.cc (Target::alignsize): Return min_align_of_type.
+
 2018-11-05  Iain Buclaw  <ibuclaw@gdcproject.org>
 
        PR d/87865
index 3ae791b5f70d9c0e445a9ae0f1b71229a276e45e..86b042938af682ae24d20c3304f8191c1b9716e4 100644 (file)
@@ -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.  */