[PR,d/87824] Committed return min_align_of_type from alignsize hook.

Message ID CABOHX+fwctV77WzdY4bvybLdEeKM88_1ddUE=_kSqdh2DwuSEQ@mail.gmail.com
State New
Headers show
Series
  • [PR,d/87824] Committed return min_align_of_type from alignsize hook.
Related show

Commit Message

Iain Buclaw Nov. 17, 2018, 11:06 a.m.
Hi,

This patch addresses some of the failing tests on x86_64-linux/-m32.
The failing tests in question checked that data with 'long' was
sufficiently aligned.

  assert((&var.longfield % long.alignof) == 0);

Where long.alignof was replaced with the result of TYPE_ALIGN_UNIT.

The D language expects the minimum alignment from .alignof, so on -m32
alignof should return 4 instead of 8.

Bootstrapped and ran D2 testsuite on x86_64-linux-gnu with
{-m64,-m32/-mno-sse/-mno-mmx,-mx32} runtest flags.

Committed to trunk as r266234.

---
gcc/d/ChangeLog:

2018-11-17  Iain Buclaw  <ibuclaw@gdcproject.org>

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

Patch

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.  */