Hi,

the attached patch is against the current HEAD, fixing one additional
test case.

Parallel testing does not seem to work anymore.  Adding the following
define for ${PWD_COMMAND} makes it work again.


diff --git a/libphobos/testsuite/Makefile.in
b/libphobos/testsuite/Makefile.in
index 26ed875d964..ae1cf83615e 100644
--- a/libphobos/testsuite/Makefile.in
+++ b/libphobos/testsuite/Makefile.in
@@ -303,6 +303,7 @@ check_DEJAGNU_libphobos_targets = $(addprefix
check-DEJAGNUlibphobos,$(check_p_s
 AM_MAKEFLAGS = "EXEEXT=$(EXEEXT)"
 CLEANFILES = *.exe *.log *.o *.sum site.exp
 all: all-am
+PWD_COMMAND = $${PWDCMD-pwd}

 .SUFFIXES:
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am
$(am__configure_deps)


Regards
 Robin

--

gcc/d/ChangeLog:

2019-04-24  Robin Dapp  <rd...@linux.ibm.com>

        * typeinfo.cc (create_typeinfo): Set fields with proper length.

gcc/testsuite/ChangeLog:

2019-04-24  Robin Dapp  <rd...@linux.ibm.com>

        * gdc.dg/runnable.d: Add Big Endian handling.
        * gdc.dg/simd.d: Likewise.
        * gdc.test/runnable/test42.d: Likewise.

libphobos/ChangeLog:

2019-04-24  Robin Dapp  <rd...@linux.ibm.com>

        * configure.tgt: Add S390.
        * libdruntime/gcc/sections/elf_shared.d: Add TLS handling for S390.
        * testsuite/libphobos.typeinfo/struct-align.d: New test.
diff --git a/gcc/d/typeinfo.cc b/gcc/d/typeinfo.cc
index dac66acdcd4..865fde2c863 100644
--- a/gcc/d/typeinfo.cc
+++ b/gcc/d/typeinfo.cc
@@ -830,7 +830,7 @@ public:
 	flags |= ClassFlags::noPointers;
 
     Lhaspointers:
-	this->layout_field (size_int (flags));
+	this->layout_field (build_integer_cst (flags, d_uint_type));
 
 	/* void *deallocator;  */
 	tree ddtor = (cd->aggDelete)
@@ -886,7 +886,7 @@ public:
 	if (cd->isCOMinterface ())
 	  flags |= ClassFlags::isCOMclass;
 
-	this->layout_field (size_int (flags));
+	this->layout_field (build_integer_cst (flags, d_uint_type));
 
 	/* void *deallocator;
 	   OffsetTypeInfo[] m_offTi;  (not implemented)
@@ -1019,7 +1019,7 @@ public:
     StructFlags::Type m_flags = 0;
     if (ti->hasPointers ())
       m_flags |= StructFlags::hasPointers;
-    this->layout_field (size_int (m_flags));
+    this->layout_field (build_integer_cst (m_flags, d_uint_type));
 
     /* void function(void*) xdtor;  */
     tree dtor = (sd->dtor) ? build_address (get_symbol_decl (sd->dtor))
@@ -1033,7 +1033,7 @@ public:
       this->layout_field (null_pointer_node);
 
     /* uint m_align;  */
-    this->layout_field (size_int (ti->alignsize ()));
+    this->layout_field (build_integer_cst (ti->alignsize (), d_uint_type));
 
     if (global.params.is64bit)
       {
@@ -1489,8 +1489,8 @@ create_typeinfo (Type *type, Module *mod)
 				      array_type_node, array_type_node,
 				      ptr_type_node, ptr_type_node,
 				      ptr_type_node, ptr_type_node,
-				      size_type_node, ptr_type_node,
-				      ptr_type_node, size_type_node,
+				      d_uint_type, ptr_type_node,
+				      ptr_type_node, d_uint_type,
 				      ptr_type_node, argtype, argtype, NULL);
 	    }
 	  t->vtinfo = TypeInfoStructDeclaration::create (t);
diff --git a/gcc/testsuite/gdc.dg/runnable.d b/gcc/testsuite/gdc.dg/runnable.d
index e36a2585027..fc5fd14c7d9 100644
--- a/gcc/testsuite/gdc.dg/runnable.d
+++ b/gcc/testsuite/gdc.dg/runnable.d
@@ -890,12 +890,18 @@ struct S186
     }
 }
 
+static if (size_t.sizeof == 8)
+     size_t checkval = 0x0200000000000002;
+static if (size_t.sizeof == 4)
+     size_t checkval = 0x02000002;
+
+
 void check186(in S186 obj, byte fieldB)
 {
     assert(obj.fieldA == 2);
     assert(obj.fieldB == 0);
     assert(obj.fieldC == 0);
-    assert(obj._complete == 2);
+    assert(obj._complete == checkval);
     assert(fieldB == 0);
 }
 
@@ -907,7 +913,7 @@ void test186a(size_t val)
     assert(obj.fieldA == 2);
     assert(obj.fieldB == 0);
     assert(obj.fieldC == 0);
-    assert(obj._complete == 2);
+    assert(obj._complete == checkval);
 
     obj = S186(val);
     check186(obj, obj.fieldB);
@@ -915,12 +921,12 @@ void test186a(size_t val)
     assert(obj.fieldA == 2);
     assert(obj.fieldB == 0);
     assert(obj.fieldC == 0);
-    assert(obj._complete == 2);
+    assert(obj._complete == checkval);
 }
 
 void test186()
 {
-    test186a(2);
+    test186a(checkval);
 }
 
 /******************************************/
diff --git a/gcc/testsuite/gdc.dg/simd.d b/gcc/testsuite/gdc.dg/simd.d
index 812b36649aa..7d0aa0168c0 100644
--- a/gcc/testsuite/gdc.dg/simd.d
+++ b/gcc/testsuite/gdc.dg/simd.d
@@ -1576,7 +1576,10 @@ ubyte[16] foounsto()
 void testOPvecunsto()
 {
     auto a = foounsto();
-    assert(a == [0, 0, 64, 65, 0, 0, 64, 65, 0, 0, 64, 65, 0, 0, 64, 65]);
+    version(LittleEndian)
+        assert(a == [0, 0, 64, 65, 0, 0, 64, 65, 0, 0, 64, 65, 0, 0, 64, 65]);
+    version(BigEndian)
+        assert(a == [65, 64, 0, 0, 65, 64, 0, 0, 65, 64, 0, 0, 65, 64, 0, 0]);
 }
 
 /*****************************************/
diff --git a/gcc/testsuite/gdc.test/runnable/test42.d b/gcc/testsuite/gdc.test/runnable/test42.d
index 87ee7a8e73a..c3cf91167b2 100644
--- a/gcc/testsuite/gdc.test/runnable/test42.d
+++ b/gcc/testsuite/gdc.test/runnable/test42.d
@@ -4963,20 +4963,34 @@ struct Test244 {
 
 int noswap245(ubyte *data)
 {
+  version (LittleEndian)
     return
         (data[0]<<  0) |
         (data[1]<<  8) |
         (data[2]<< 16) |
         (data[3]<< 24);
+  version (BigEndian)
+    return
+        (data[0]<< 24) |
+        (data[1]<< 16) |
+        (data[2]<<  8) |
+        (data[3]<<  0);
 }
 
 int bswap245(ubyte *data)
 {
+  version (LittleEndian)
     return
         (data[0]<< 24) |
         (data[1]<< 16) |
-        (data[2]<< 8 ) |
-        (data[3]<< 0 );
+        (data[2]<<  8) |
+        (data[3]<<  0);
+  version (BigEndian)
+    return
+        (data[0]<<  0) |
+        (data[1]<<  8) |
+        (data[2]<< 16) |
+        (data[3]<< 24);
 }
 
 void test245()
diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt
index b30f0858108..9c6e1a04cc7 100644
--- a/libphobos/configure.tgt
+++ b/libphobos/configure.tgt
@@ -41,4 +41,7 @@ case "${target}" in
   x86_64-*-solaris2.11* | i?86-*-solaris2.11*)
 	LIBPHOBOS_SUPPORTED=yes
 	;;
+  s390*-linux*)
+	LIBPHOBOS_SUPPORTED=yes
+        ;;
 esac
diff --git a/libphobos/libdruntime/gcc/sections/elf_shared.d b/libphobos/libdruntime/gcc/sections/elf_shared.d
index 4cf5a233fc4..a957e551c14 100644
--- a/libphobos/libdruntime/gcc/sections/elf_shared.d
+++ b/libphobos/libdruntime/gcc/sections/elf_shared.d
@@ -980,6 +980,7 @@ struct tls_index
 }
 
 extern(C) void* __tls_get_addr(tls_index* ti) nothrow @nogc;
+extern(C) void* __tls_get_addr_internal(tls_index* ti) nothrow @nogc;
 
 /* The dynamic thread vector (DTV) pointers may point 0x8000 past the start of
  * each TLS block. This is at least true for PowerPC and Mips platforms.
@@ -1013,6 +1014,8 @@ else version (MIPS32)
     enum TLS_DTV_OFFSET = 0x8000;
 else version (MIPS64)
     enum TLS_DTV_OFFSET = 0x8000;
+else version (SystemZ)
+    enum TLS_DTV_OFFSET = 0;
 else
     static assert( false, "Platform not supported." );
 
@@ -1029,5 +1032,14 @@ void[] getTLSRange(size_t mod, size_t sz) nothrow @nogc
 
     // base offset
     auto ti = tls_index(mod, 0);
-    return (__tls_get_addr(&ti)-TLS_DTV_OFFSET)[0 .. sz];
+
+    version (SystemZ)
+      {
+          import gcc.builtins;
+          auto idx = cast(void *)__tls_get_addr_internal(&ti)
+              + cast(ulong)__builtin_thread_pointer ();
+          return idx[0 .. sz];
+      }
+    else
+        return (__tls_get_addr(&ti)-TLS_DTV_OFFSET)[0 .. sz];
 }
diff --git a/libphobos/testsuite/libphobos.typeinfo/struct-align.d b/libphobos/testsuite/libphobos.typeinfo/struct-align.d
new file mode 100644
index 00000000000..72866517481
--- /dev/null
+++ b/libphobos/testsuite/libphobos.typeinfo/struct-align.d
@@ -0,0 +1,13 @@
+module structalign;
+
+void main ()
+{
+    struct K { int *a; };
+    K k;
+    auto ti = typeid (k);
+
+    assert (ti.flags () == 1);
+
+    auto ti2 = typeid (k.a);
+    assert (ti.talign () == ti2.talign ());
+}

Reply via email to