This fixes a segmentation fault issue when building without object.d and improves portability for the runnable/test4 test.
--- gcc/d/dmd/MERGE | 2 +- gcc/d/dmd/dmodule.c | 2 +- gcc/testsuite/gdc.test/runnable/test4.d | 60 +++++++++---------------- 3 files changed, 22 insertions(+), 42 deletions(-) diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE index 230fd12db2b..a8757427849 100644 --- a/gcc/d/dmd/MERGE +++ b/gcc/d/dmd/MERGE @@ -1,4 +1,4 @@ -8d4c876c658608e8f6e653803c534a9e15618f57 +fe8b2c2c2a4ede475f15a082f26460275cdef42e The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/gcc/d/dmd/dmodule.c b/gcc/d/dmd/dmodule.c index 20dbb69a91c..07e47127130 100644 --- a/gcc/d/dmd/dmodule.c +++ b/gcc/d/dmd/dmodule.c @@ -302,7 +302,7 @@ bool Module::read(Loc loc) { ::error(loc, "cannot find source code for runtime library file 'object.d'"); errorSupplemental(loc, "dmd might not be correctly installed. Run 'dmd -man' for installation instructions."); - const char *dmdConfFile = FileName::canonicalName(global.inifilename); + const char *dmdConfFile = global.inifilename ? FileName::canonicalName(global.inifilename) : NULL; errorSupplemental(loc, "config file: %s", dmdConfFile ? dmdConfFile : "not found"); } else diff --git a/gcc/testsuite/gdc.test/runnable/test4.d b/gcc/testsuite/gdc.test/runnable/test4.d index f008da6da72..b5263e7a9d1 100644 --- a/gcc/testsuite/gdc.test/runnable/test4.d +++ b/gcc/testsuite/gdc.test/runnable/test4.d @@ -224,46 +224,26 @@ void test6() assert(&t.Bottom < &t.foo2); assert(TRECT6.foo1.offsetof == 0); -version (Win32) -{ - assert(TRECT6.Left.offsetof == 8); - assert(TRECT6.Top.offsetof == 12); - assert(TRECT6.Right.offsetof == 16); - assert(TRECT6.Bottom.offsetof == 20); - assert(TRECT6.TopLeft.offsetof == 8); - assert(TRECT6.BottomRight.offsetof == 16); - assert(TRECT6.foo2.offsetof == 24); -} -else version (X86_64) -{ - assert(TRECT6.Left.offsetof == 8); - assert(TRECT6.Top.offsetof == 12); - assert(TRECT6.Right.offsetof == 16); - assert(TRECT6.Bottom.offsetof == 20); - assert(TRECT6.TopLeft.offsetof == 8); - assert(TRECT6.BottomRight.offsetof == 16); - assert(TRECT6.foo2.offsetof == 24); -} -else version(ARM) -{ - assert(TRECT6.Left.offsetof == 8); - assert(TRECT6.Top.offsetof == 12); - assert(TRECT6.Right.offsetof == 16); - assert(TRECT6.Bottom.offsetof == 20); - assert(TRECT6.TopLeft.offsetof == 8); - assert(TRECT6.BottomRight.offsetof == 16); - assert(TRECT6.foo2.offsetof == 24); -} -else -{ - assert(TRECT6.Left.offsetof == 4); - assert(TRECT6.Top.offsetof == 8); - assert(TRECT6.Right.offsetof == 12); - assert(TRECT6.Bottom.offsetof == 16); - assert(TRECT6.TopLeft.offsetof == 4); - assert(TRECT6.BottomRight.offsetof == 12); - assert(TRECT6.foo2.offsetof == 20); -} + static if (long.alignof == 8) + { + assert(TRECT6.Left.offsetof == 8); + assert(TRECT6.Top.offsetof == 12); + assert(TRECT6.Right.offsetof == 16); + assert(TRECT6.Bottom.offsetof == 20); + assert(TRECT6.TopLeft.offsetof == 8); + assert(TRECT6.BottomRight.offsetof == 16); + assert(TRECT6.foo2.offsetof == 24); + } + else + { + assert(TRECT6.Left.offsetof == 4); + assert(TRECT6.Top.offsetof == 8); + assert(TRECT6.Right.offsetof == 12); + assert(TRECT6.Bottom.offsetof == 16); + assert(TRECT6.TopLeft.offsetof == 4); + assert(TRECT6.BottomRight.offsetof == 12); + assert(TRECT6.foo2.offsetof == 20); + } } /* ================================ */ -- 2.19.2