d: Move all runnable tests in gdc.dg to gdc.dg/torture
authorIain Buclaw <ibuclaw@gdcproject.org>
Mon, 31 Aug 2020 16:23:12 +0000 (18:23 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Wed, 2 Sep 2020 20:59:34 +0000 (22:59 +0200)
Tests that are not executed do not need to be compiled as torture tests,
they are only present for testing for a certain bug or ICE.

gcc/testsuite/ChangeLog:

* gdc.dg/dg.exp: Remove torture options.
* gdc.dg/gdc115.d: Move test to gdc.dg/torture.
* gdc.dg/gdc131.d: Likewise.
* gdc.dg/gdc141.d: Likewise.
* gdc.dg/gdc17.d: Likewise.
* gdc.dg/gdc171.d: Likewise.
* gdc.dg/gdc179.d: Likewise.
* gdc.dg/gdc186.d: Likewise.
* gdc.dg/gdc187.d: Likewise.
* gdc.dg/gdc191.d: Likewise.
* gdc.dg/gdc198.d: Likewise.
* gdc.dg/gdc200.d: Likewise.
* gdc.dg/gdc210.d: Likewise.
* gdc.dg/gdc240.d: Likewise.
* gdc.dg/gdc242b.d: Likewise.
* gdc.dg/gdc248.d: Likewise.
* gdc.dg/gdc250.d: Likewise.
* gdc.dg/gdc273.d: Likewise.
* gdc.dg/gdc283.d: Likewise.
* gdc.dg/gdc285.d: Likewise.
* gdc.dg/gdc286.d: Likewise.
* gdc.dg/gdc309.d: Likewise.
* gdc.dg/gdc35.d: Likewise.
* gdc.dg/gdc36.d: Likewise.
* gdc.dg/gdc51.d: Likewise.
* gdc.dg/gdc57.d: Likewise.
* gdc.dg/gdc66.d: Likewise.
* gdc.dg/imports/gdc36.d: Likewise.
* gdc.dg/init1.d: Likewise.
* gdc.dg/pr92309.d: Likewise.
* gdc.dg/pr94424.d: Likewise.
* gdc.dg/pr94777b.d: Likewise.
* gdc.dg/pr96152.d: Likewise.
* gdc.dg/pr96153.d: Likewise.
* gdc.dg/pr96156.d: Likewise.
* gdc.dg/pr96157a.d: Likewise.
* gdc.dg/torture/torture.exp: New file.

72 files changed:
gcc/testsuite/gdc.dg/dg.exp
gcc/testsuite/gdc.dg/gdc115.d [deleted file]
gcc/testsuite/gdc.dg/gdc131.d [deleted file]
gcc/testsuite/gdc.dg/gdc141.d [deleted file]
gcc/testsuite/gdc.dg/gdc17.d [deleted file]
gcc/testsuite/gdc.dg/gdc171.d [deleted file]
gcc/testsuite/gdc.dg/gdc179.d [deleted file]
gcc/testsuite/gdc.dg/gdc186.d [deleted file]
gcc/testsuite/gdc.dg/gdc187.d [deleted file]
gcc/testsuite/gdc.dg/gdc191.d [deleted file]
gcc/testsuite/gdc.dg/gdc198.d [deleted file]
gcc/testsuite/gdc.dg/gdc200.d [deleted file]
gcc/testsuite/gdc.dg/gdc210.d [deleted file]
gcc/testsuite/gdc.dg/gdc240.d [deleted file]
gcc/testsuite/gdc.dg/gdc242b.d [deleted file]
gcc/testsuite/gdc.dg/gdc248.d [deleted file]
gcc/testsuite/gdc.dg/gdc250.d [deleted file]
gcc/testsuite/gdc.dg/gdc273.d [deleted file]
gcc/testsuite/gdc.dg/gdc283.d [deleted file]
gcc/testsuite/gdc.dg/gdc285.d [deleted file]
gcc/testsuite/gdc.dg/gdc286.d [deleted file]
gcc/testsuite/gdc.dg/gdc309.d [deleted file]
gcc/testsuite/gdc.dg/gdc35.d [deleted file]
gcc/testsuite/gdc.dg/gdc36.d [deleted file]
gcc/testsuite/gdc.dg/gdc51.d [deleted file]
gcc/testsuite/gdc.dg/gdc57.d [deleted file]
gcc/testsuite/gdc.dg/gdc66.d [deleted file]
gcc/testsuite/gdc.dg/imports/gdc36.d [deleted file]
gcc/testsuite/gdc.dg/init1.d [deleted file]
gcc/testsuite/gdc.dg/pr92309.d [deleted file]
gcc/testsuite/gdc.dg/pr94424.d [deleted file]
gcc/testsuite/gdc.dg/pr94777b.d [deleted file]
gcc/testsuite/gdc.dg/pr96152.d [deleted file]
gcc/testsuite/gdc.dg/pr96153.d [deleted file]
gcc/testsuite/gdc.dg/pr96156.d [deleted file]
gcc/testsuite/gdc.dg/pr96157a.d [deleted file]
gcc/testsuite/gdc.dg/torture/gdc115.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc131.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc141.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc17.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc171.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc179.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc186.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc187.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc191.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc198.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc200.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc210.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc240.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc242b.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc248.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc250.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc273.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc283.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc285.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc286.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc309.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc35.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc36.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc51.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc57.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/gdc66.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/imports/gdc36.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/init1.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/pr92309.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/pr94424.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/pr94777b.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/pr96152.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/pr96153.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/pr96156.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/pr96157a.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/torture/torture.exp [new file with mode: 0644]

index 15cbe1c416855a554d20c7fda9a151c3afcbfb28..47a16da3f0aebb71b3b3910d0dc58c5eca910ef1 100644 (file)
 # Load support procs.
 load_lib gdc-dg.exp
 
-# The default option list can be overridden by
-# TORTURE_OPTIONS="{ { list1 } ... { listN } }"
-
-if ![info exists TORTURE_OPTIONS] {
-    set TORTURE_OPTIONS [list \
-       { -O0 } { -O1 } { -O2 } { -O3 } { -Os } \
-       { -O0 -frelease } { -O0 -g } { -O0 -frelease -g } \
-       { -O1 -frelease } { -O1 -g } { -O1 -frelease -g } \
-       { -O2 -frelease } { -O2 -g } { -O2 -frelease -g } \
-       { -O3 -frelease } { -O3 -g } { -O3 -frelease -g } \
-       { -Os -frelease } { -Os -g } { -Os -frelease -g }]
+# If a testcase doesn't have special options, use these.
+global DEFAULT_DFLAGS
+if ![info exists DEFAULT_DFLAGS] then {
+    set DEFAULT_DFLAGS ""
 }
 
 # Initialize `dg'.
 dg-init
 
-# Initialize use of torture lists.
-torture-init
-set-torture-options $TORTURE_OPTIONS
-
 # Main loop.
 gdc-dg-runtest [lsort \
-       [glob -nocomplain $srcdir/$subdir/*.d ] ] "" ""
-
-# Finalize use of torture lists.
-torture-finish
+       [glob -nocomplain $srcdir/$subdir/*.d ] ] "" $DEFAULT_DFLAGS
 
 # All done.
 dg-finish
diff --git a/gcc/testsuite/gdc.dg/gdc115.d b/gcc/testsuite/gdc.dg/gdc115.d
deleted file mode 100644 (file)
index 8eca2eb..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=115
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-void main()
-{
-    union U
-    {
-        float f;
-        uint i;
-    }
-    float a = 123.0;
-    const l = U(a);
-
-    assert(l.i == U(a).i);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc131.d b/gcc/testsuite/gdc.dg/gdc131.d
deleted file mode 100644 (file)
index 394a909..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=131
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-struct S131
-{
-    this(string ) { }
-    string opAssign(string v) { return v; }
-}
-
-void main()
-{
-    S131[string] s;
-    s["foo"] = "bar";
-}
diff --git a/gcc/testsuite/gdc.dg/gdc141.d b/gcc/testsuite/gdc.dg/gdc141.d
deleted file mode 100644 (file)
index 9a3d5c5..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=141
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-bool test141(int a)
-{
-    return a > (a + 1);
-}
-
-void main()
-{
-    assert(test141(int.min) == false);
-    assert(test141(int.max) == true);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc17.d b/gcc/testsuite/gdc.dg/gdc17.d
deleted file mode 100644 (file)
index 0fd5847..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=17
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-/**
- * Parameters are not copied into a frame to be accessed from
- * the method's __require function.
- */
-void contractTest(string path)
-{
-    assert(path[0] == 't');
-    assert(path.length == 9);
-    assert(path[8] == 'i');
-}
-
-interface ModuleSaver
-{
-    void save(string str)
-    in
-    {
-        contractTest(str);
-    }
-}
-
-class ModuleWriter : ModuleSaver
-{
-    void save (string str)
-    in {}
-    do
-    {
-    }
-}
-
-void main()
-{
-  (new ModuleWriter()).save ("test.0.mci");
-}
diff --git a/gcc/testsuite/gdc.dg/gdc171.d b/gcc/testsuite/gdc.dg/gdc171.d
deleted file mode 100644 (file)
index f8b7fde..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=171
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-void test171a()
-{
-    int count = 0;
-    short a = -1;
-    while (a != 0)
-    {
-        a >>>= 1;
-        count++;
-        assert(count <= 16);
-    }
-}
-
-void test171b()
-{
-    uint[3] lhs = [99, 201, 300],
-            rhs = [-1, 0, 0];
-    long t = 0;
-
-    for (int i = 0; i < 3; i++)
-    {
-        t += lhs[i];
-        t -= rhs[i];
-        lhs[i] = cast(uint) t;
-        t >>= uint.sizeof * 8;
-    }
-
-    assert(lhs == [100, 200, 300]);
-}
-
-void main()
-{
-    test171a();
-    test171b();
-}
diff --git a/gcc/testsuite/gdc.dg/gdc179.d b/gcc/testsuite/gdc.dg/gdc179.d
deleted file mode 100644 (file)
index 72fe0b7..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=179
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-import core.stdc.stdio;
-
-struct S179a
-{
-    @disable this(this);
-}
-
-struct S179b
-{
-    S179a s1;
-    void connect() { printf("this=%p\n", &this); }
-}
-
-class C179
-{
-    private S179b s2;
-    ref S179b value() @property
-    {
-        printf("this=%p\n", &s2);
-        return s2;
-    }
-}
-
-void main()
-{
-    C179 a = new C179;
-    a.value.connect();
-}
diff --git a/gcc/testsuite/gdc.dg/gdc186.d b/gcc/testsuite/gdc.dg/gdc186.d
deleted file mode 100644 (file)
index 4a1a91a..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=186
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-struct S186
-{
-    union
-    {
-        struct
-        {
-            ubyte fieldA;
-            byte  fieldB = -1;
-            byte fieldC = -1;
-        }
-        size_t _complete;
-    }
-
-    this(size_t complete)
-    {
-        this._complete = complete;
-    }
-}
-
-static if (size_t.sizeof == 8)
-    enum checkval = 0x0200000000000002;
-else
-    enum checkval = 0x02000002;
-
-void check186(in S186 obj, byte fieldB)
-{
-    assert(obj.fieldA == 2);
-    assert(obj.fieldB == 0);
-    assert(obj.fieldC == 0);
-    assert(obj._complete == checkval);
-    assert(fieldB == 0);
-}
-
-void test186(size_t val)
-{
-    S186 obj = S186(val);
-    check186(obj, obj.fieldB);
-
-    assert(obj.fieldA == 2);
-    assert(obj.fieldB == 0);
-    assert(obj.fieldC == 0);
-    assert(obj._complete == checkval);
-
-    obj = S186(val);
-    check186(obj, obj.fieldB);
-
-    assert(obj.fieldA == 2);
-    assert(obj.fieldB == 0);
-    assert(obj.fieldC == 0);
-    assert(obj._complete == checkval);
-}
-
-void main()
-{
-    test186(checkval);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc187.d b/gcc/testsuite/gdc.dg/gdc187.d
deleted file mode 100644 (file)
index 2f469ad..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=187
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-align(1) struct S187b
-{
-    align(1)
-    {
-        uint unpaddedA;
-        ushort unpaddedB;
-    }
-}
-
-struct S187a
-{
-    S187b[3] unpaddedArray;
-    ubyte wontInitialize = ubyte.init;
-}
-
-struct S187
-{
-    S187a interesting;
-}
-
-
-void prepareStack()
-{
-    byte[255] stackGarbage;
-    foreach(i, ref b; stackGarbage)
-    {
-        b  = cast(byte)(-i);
-    }
-}
-
-void main()
-{
-    prepareStack();
-    auto a = S187(S187a());
-    assert(a.interesting.wontInitialize == 0);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc191.d b/gcc/testsuite/gdc.dg/gdc191.d
deleted file mode 100644 (file)
index 4d2ca9d..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=191
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-class C191
-{
-    int count = 0;
-
-    void testA()
-    {
-        class Inner
-        {
-            void test()
-            {
-                void localFunction()
-                {
-                    if (++count != 5)
-                        testA();
-                }
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-
-    void testB()
-    {
-        class Inner
-        {
-            void test()
-            {
-                void localFunction()
-                {
-                    void anotherLocalFunction()
-                    {
-                        if (++count != 10)
-                            testB();
-                    }
-                    anotherLocalFunction();
-                }
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-
-    void testC()
-    {
-        class Inner
-        {
-            int a = 1;
-
-            void test()
-            {
-                void localFunction()
-                {
-                    count += a;
-                    if (count != 15)
-                        testC();
-                    assert(a == 1);
-                }
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-
-    void testD()
-    {
-        class Inner
-        {
-            void test()
-            {
-                int a = 1;
-
-                void localFunction()
-                {
-                    count += a;
-                    if (count != 20)
-                        testD();
-                    assert(a == 1);
-                }
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-
-    void testE()
-    {
-        class Inner
-        {
-            int a = 1;
-
-            void test()
-            {
-                void localFunction()
-                {
-                    void anotherLocalFunction()
-                    {
-                        count += a;
-                        if (count != 25)
-                            testE();
-                        assert(a == 1);
-                    }
-
-                    anotherLocalFunction();
-                }
-
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-
-    void testF()
-    {
-        class Inner
-        {
-            void test()
-            {
-                int a = 1;
-
-                void localFunction()
-                {
-                    void anotherLocalFunction()
-                    {
-                        count += a;
-                        if (count != 30)
-                            testF();
-                        assert(a == 1);
-                    }
-
-                    anotherLocalFunction();
-                }
-
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-
-    void testG()
-    {
-        class Inner
-        {
-            void test()
-            {
-                void localFunction()
-                {
-                    int a = 1;
-
-                    void anotherLocalFunction()
-                    {
-                        count += a;
-                        if (count != 35)
-                            testG();
-                        assert(a == 1);
-                    }
-
-                    anotherLocalFunction();
-                }
-
-                localFunction();
-            }
-        }
-        scope ic = new Inner();
-        ic.test();
-    }
-}
-
-void main()
-{
-    scope oc = new C191();
-    oc.testA();
-    assert(oc.count == 5);
-
-    oc.testB();
-    assert(oc.count == 10);
-
-    oc.testC();
-    assert(oc.count == 15);
-
-    oc.testD();
-    assert(oc.count == 20);
-
-    oc.testE();
-    assert(oc.count == 25);
-
-    oc.testF();
-    assert(oc.count == 30);
-
-    oc.testG();
-    assert(oc.count == 35);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc198.d b/gcc/testsuite/gdc.dg/gdc198.d
deleted file mode 100644 (file)
index 09daf85..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=198
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-struct S198a
-{
-    union
-    {
-        float[3] v;
-        struct
-        {
-            float x;
-            float y;
-            float z;
-        }
-    }
-
-    this(float x_, float y_, float z_)
-    {
-        x = x_;
-        y = y_;
-        z = z_;
-    }
-
-    ref S198a opOpAssign(string op)(S198a operand)
-    if (op == "+")
-    {
-        x += operand.x;
-        y += operand.y;
-        z += operand.z;
-        return this;
-    }
-}
-
-struct S198b
-{
-    @property get()
-    {
-        union Buf
-        {
-            void[0] result;
-        }
-        const Buf buf = { };
-        return buf.result;
-    }
-}
-
-struct S198c
-{
-    @property get()
-    {
-        union Buf
-        {
-            TypeInfo info;
-            void[0] result;
-        }
-        const Buf buf = { };
-        return buf.result;
-    }
-}
-
-
-void main()
-{
-    S198a sum = S198a(0, 0, 0);
-
-    foreach(size_t v; 0 .. 3)
-        sum += S198a(1, 2, 3);
-
-    assert(sum.v == [3, 6, 9]);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc200.d b/gcc/testsuite/gdc.dg/gdc200.d
deleted file mode 100644 (file)
index 585d60f..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=200
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-void test200a(double x, double y)
-{
-  const double y2 = x + 1.0;
-  assert(y == y2);
-}
-
-void main()
-{
-  const double x = .012;
-  const double y = x + 1.0;
-  test200a(x, y);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc210.d b/gcc/testsuite/gdc.dg/gdc210.d
deleted file mode 100644 (file)
index 0f56073..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=210
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-struct S210
-{
-    ubyte a;
-    uint b;
-}
-
-union U210
-{
-    S210 a;
-    uint b;
-}
-
-S210 test210a()
-{
-    S210 s = S210(1, 2);
-    return s;
-}
-
-S210[2] test210b()
-{
-    S210[2] s = [S210(1, 2), S210(3, 4)];
-    return s;
-}
-
-U210 test210c()
-{
-    U210 s = U210(S210(1, 2));
-    return s;
-}
-
-U210[2] test210d()
-{
-    U210[2] s = [U210(S210(1, 2)), U210(S210(3, 4))];
-    return s;
-}
-
-void main()
-{
-    S210 a = S210(1, 2);
-    assert(a == S210(1, 2));
-    assert(a == test210a());
-    assert(a != S210(2, 1));
-
-    S210[2] b = [S210(1, 2), S210(3, 4)];
-    assert(b == [S210(1, 2), S210(3, 4)]);
-    assert(b == test210b());
-    assert(b != [S210(2, 1), S210(3, 4)]);
-
-    U210 c = U210(S210(1, 2));
-    assert(c == U210(S210(1, 2)));
-    assert(c == test210c());
-    assert(c != U210(S210(2, 1)));
-
-    U210[2] d = [U210(S210(1, 2)), U210(S210(3, 4))];
-    assert(d == [U210(S210(1, 2)), U210(S210(3, 4))]);
-    assert(d == test210d());
-    assert(d != [U210(S210(2, 1)), U210(S210(3, 4))]);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc240.d b/gcc/testsuite/gdc.dg/gdc240.d
deleted file mode 100644 (file)
index 76f6dcf..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=240
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-void test240(int a, int b)
-{
-    assert(a == 0);
-    assert(b == 0);
-}
-
-void main()
-{
-    int a = 0;
-    test240(a, a++);
-    assert(a == 1);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc242b.d b/gcc/testsuite/gdc.dg/gdc242b.d
deleted file mode 100644 (file)
index cfba4b4..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=242
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-struct S242
-{
-    enum M = S242();
-    int a = 42;
-
-    auto iter()
-    {
-        this.a = 24;
-        return this;
-    }
-}
-
-S242 test242()
-{
-    return S242.M.iter;
-}
-
-void main()
-{
-    assert(test242() == S242(24));
-}
diff --git a/gcc/testsuite/gdc.dg/gdc248.d b/gcc/testsuite/gdc.dg/gdc248.d
deleted file mode 100644 (file)
index 0fd0277..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=248
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-class C248b
-{
-    bool isintegral()
-    {
-        return false;
-    }
-}
-
-class C248a
-{
-    int count = 0;
-
-    C248b getMemtype()
-    {
-        count++;
-        return new C248b();
-    }
-}
-
-class C248
-{
-    C248a sym;
-
-    this()
-    {
-        this.sym = new C248a();
-    }
-
-    bool isintegral()
-    {
-        return sym.getMemtype().isintegral();
-    }
-}
-
-void main()
-{
-    C248 e = new C248();
-    e.isintegral();
-    assert(e.sym.count == 1);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc250.d b/gcc/testsuite/gdc.dg/gdc250.d
deleted file mode 100644 (file)
index c8182da..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=250
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-void main()
-{
-    struct S
-    {
-        string data;
-    }
-
-    auto a = S("hello");
-    auto b = S("hello".dup);
-
-    assert(a.data == b.data);
-    assert(a == b);
-    assert([a] == [b]);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc273.d b/gcc/testsuite/gdc.dg/gdc273.d
deleted file mode 100644 (file)
index b5d2b10..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=273
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-class B273
-{
-    B273[] members;
-}
-
-class D273 : B273
-{
-}
-
-void main()
-{
-    auto noPointers = ClassInfo.ClassFlags.noPointers;
-    assert((B273.classinfo.m_flags & noPointers) == 0);
-    assert((D273.classinfo.m_flags & noPointers) == 0);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc283.d b/gcc/testsuite/gdc.dg/gdc283.d
deleted file mode 100644 (file)
index ca7ad3f..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=283
-// { dg-do run { target hw } }
-
-struct Impl
-{
-    size_t _count;
-}
-
-struct RefCountedStore
-{
-    Impl* _store;
-
-    void initialize()
-    {
-        import core.stdc.stdlib : malloc;
-        _store = cast(Impl*) malloc(Impl.sizeof);
-        _store._count = 1;
-    }
-
-    bool isInitialized()
-    {
-        return _store !is null;
-    }
-
-    void ensureInitialized()
-    {
-        if (!isInitialized)
-            initialize();
-    }
-}
-
-struct RefCounted14443
-{
-    RefCountedStore _refCounted;
-
-    this(int)
-    {
-        _refCounted.initialize();
-    }
-
-    this(this)
-    {
-        ++_refCounted._store._count;
-    }
-
-    ~this()
-    {
-        if (--_refCounted._store._count)
-            return;
-
-        import core.stdc.stdlib : free;
-        free(_refCounted._store);
-        _refCounted._store = null;
-    }
-
-    int refCountedPayload()
-    {
-        _refCounted.ensureInitialized();
-        return 1;
-    }
-}
-
-struct PathRange14443
-{
-    RefCounted14443 path;
-
-    @property PathElement14443 front()
-    {
-        return PathElement14443(this, path.refCountedPayload());
-    }
-}
-
-struct PathElement14443
-{
-    PathRange14443 range;
-
-    this(PathRange14443 range, int)
-    {
-        this.range = range;
-    }
-}
-
-void main()
-{
-    auto path = RefCounted14443(12);
-    if (path._refCounted._store._count != 1)
-        assert(0);
-    {
-        auto _r = PathRange14443(path);
-        if (path._refCounted._store._count != 2)
-            assert(0);
-        {
-            auto element = _r.front;
-            if (path._refCounted._store._count != 3)
-                assert(0);
-        }
-        if (path._refCounted._store._count != 2)
-            assert(0);
-    }
-    if (path._refCounted._store._count != 1)
-        assert(0);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc285.d b/gcc/testsuite/gdc.dg/gdc285.d
deleted file mode 100644 (file)
index f94ffb5..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=285
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-inout(char)[] test285(inout(char)* s) @nogc @system pure nothrow
-{
-    import core.stdc.string : strlen;
-    return s ? s[0 .. strlen(s)] : null;
-}
-
-void main()
-{
-    assert(test285(null) == null);
-    assert(test285("foo") == "foo");
-}
diff --git a/gcc/testsuite/gdc.dg/gdc286.d b/gcc/testsuite/gdc.dg/gdc286.d
deleted file mode 100644 (file)
index 2536ef6..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=286
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-void main()
-{
-    struct K286
-    {
-        int count;
-        this(this)
-        {
-            count++;
-        }
-    }
-
-    struct S286
-    {
-        int data;
-        this(K286 key)
-        {
-            data = key.count;
-        }
-    }
-
-    S286 getData(K286 key)
-    {
-        static S286[K286] getCache;
-        auto p = key in getCache;
-        if (p)
-            return *p;
-        return (getCache[key] = S286(key));
-    }
-
-    auto s = getData(K286());
-    if (s.data == 0)
-        assert(0);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc309.d b/gcc/testsuite/gdc.dg/gdc309.d
deleted file mode 100644 (file)
index bbcb6e7..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=309
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-void main()
-{
-    creal f1 = +0.0 + 0.0i;
-    creal f2 = +0.0 - 0.0i;
-    creal f3 = -0.0 + 0.0i;
-    creal f4 = +0.0 + 0.0i;
-
-    assert(f1 !is f2);
-    assert(f1 !is f3);
-    assert(f2 !is f3);
-    assert(f1 is f4);
-
-    assert(!(f1 is f2));
-    assert(!(f1 is f3));
-    assert(!(f2 is f3));
-    assert(!(f1 !is f4));
-
-    struct CReal
-    {
-        creal value;
-    }
-
-    CReal s1 = CReal(+0.0 + 0.0i);
-    CReal s2 = CReal(+0.0 - 0.0i);
-    CReal s3 = CReal(-0.0 + 0.0i);
-    CReal s4 = CReal(+0.0 + 0.0i);
-
-    assert(s1 !is s2);
-    assert(s1 !is s3);
-    assert(s2 !is s3);
-    assert(s1 is s4);
-
-    assert(!(s1 is s2));
-    assert(!(s1 is s3));
-    assert(!(s2 is s3));
-    assert(!(s1 !is s4));
-}
diff --git a/gcc/testsuite/gdc.dg/gdc35.d b/gcc/testsuite/gdc.dg/gdc35.d
deleted file mode 100644 (file)
index 773a78a..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=35
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-/**
- * Here the BinaryHeap instance uses an alias parameter and therefore
- * the instance's functions (percolateDown) need to be generated in
- * topNIndex->BinaryHeap scope and not in the declaration scope
- * (module->BinaryHeap).
- */
-void topNIndex()()
-{
-    bool indirectLess(int a, int b)
-    {
-        return a > b;
-    }
-
-    auto a = BinaryHeap!(indirectLess)();
-}
-
-struct BinaryHeap(alias less)
-{
-    void percolateDown()
-    {
-        less(0, 1);
-    }
-}
-
-void test35a()
-{
-    topNIndex();
-}
-
-/*
- * Similar as test35a but with an additional indirection.
- * The nested function chain for percolateDown should look like this:
- * topNIndex2->BinaryHeap2->percolateDown.
- */
-void topNIndex2()()
-{
-    bool indirectLess(int a, int b)
-    {
-        return a > b;
-    }
-    auto a = BinaryHeap2!(S35b!(indirectLess)())();
-}
-
-struct S35b(alias a)
-{
-    void foo()
-    {
-        a(0, 0);
-    }
-}
-
-struct BinaryHeap2(alias less)
-{
-    void percolateDown()
-    {
-        less.foo();
-    }
-}
-
-void test35b()
-{
-    topNIndex2();
-}
-
-void main()
-{
-    test35a();
-    test35b();
-}
diff --git a/gcc/testsuite/gdc.dg/gdc36.d b/gcc/testsuite/gdc.dg/gdc36.d
deleted file mode 100644 (file)
index fbb876c..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=36
-// { dg-additional-sources "imports/gdc36.d" }
-// { dg-options "-I $srcdir/gdc.dg" }
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-module gdc36;
-
-import imports.gdc36;
-
-/**
- * Here getChar is a function in a template where template.isnested == false
- * but getChar still is a nested function and needs to get a static chain
- * containing test36a.
- */
-void test36a()(char val)
-{
-    void error()
-    {
-    }
-
-    void getChar()()
-    {
-        error();
-    }
-
-    void parseString()
-    {
-        getChar();
-    }
-}
-
-/**
- * Similar as test36a, but a little more complicated:
- * Here getChar is nested in a struct template which is nested in a function.
- * getChar's static chain still needs to contain test36b.
- */
-void test36b()(char val)
-{
-    void error()
-    {
-    }
-
-    struct S(T)
-    {
-        void getChar()
-        {
-            error();
-        }
-    }
-
-
-    void parseString()
-    {
-        S!(int)().getChar();
-    }
-}
-
-/**
- * If g had accessed a, the frontend would have generated a closure.
- *
- * As we do not access it, there's no closure. We have to be careful
- * not to set a static chain for g containing test36c_1 though,
- * as g can be called from outside (here from test1c). In the end
- * we have to treat this as if everything in test36c_1 was declared
- * at module scope.
- */
-auto test36c_1()
-{
-    int a;
-    void c() {}
-    class Result
-    {
-        int b;
-        void g() { c(); /*a = 42;*/ }
-    }
-
-    return new Result();
-}
-
-void test36c()
-{
-    test36c_1().g();
-}
-
-/**
- * empty is a (private) function which is nested in lightPostprocess.
- * At the same time it's a template instance, so it has to be declared as
- * weak or otherwise one-only. imports/gdc36.d creates another instance
- * of Regex!char to verify that.
- */
-struct Parser(R)
-{
-    @property program()
-    {
-        return Regex!char();
-    }
-}
-
-struct Regex(Char)
-{
-    @trusted lightPostprocess()
-    {
-        struct FixedStack(T)
-        {
-            @property empty() { return false; }
-        }
-        auto counterRange = FixedStack!uint();
-    }
-}
-
-void test36d()
-{
-    auto parser = Parser!(char[])();
-    imports.gdc36.test36d_1;
-}
-
-void main()
-{
-  test36a('n');
-  test36b('n');
-  test36c();
-  test36d();
-}
-
diff --git a/gcc/testsuite/gdc.dg/gdc51.d b/gcc/testsuite/gdc.dg/gdc51.d
deleted file mode 100644 (file)
index e6ffbd4..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=51
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-struct S51
-{
-    int x;
-    int pad;
-
-    this(this)
-    {
-        ++x;
-    }
-}
-
-void main()
-{
-    S51 s;
-    auto sarr = new S51[1];
-    auto sarr2 = sarr;
-
-    // postblit all fields.
-    sarr2 ~= s;
-
-    assert (sarr2[0].x == 1);
-    assert (sarr2[1].x == 1);
-    assert (sarr[0].x == 0);
-    assert (s.x == 0);
-}
diff --git a/gcc/testsuite/gdc.dg/gdc57.d b/gcc/testsuite/gdc.dg/gdc57.d
deleted file mode 100644 (file)
index b378286..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=57
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-struct S57
-{
-    int a;
-    long b;
-    // Doesn't happen for bigger structs
-}
-
-S57 bar57()
-{
-    return S57(4, 42);
-}
-
-void main()
-{
-    S57 s = bar57();
-    assert (s is S57(4, 42));
-}
diff --git a/gcc/testsuite/gdc.dg/gdc66.d b/gcc/testsuite/gdc.dg/gdc66.d
deleted file mode 100644 (file)
index f499c83..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-// https://bugzilla.gdcproject.org/show_bug.cgi?id=66
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-void main()
-{
-    int pos = 0;
-
-    foreach(x; 0 .. 64)
-    {
-        ++pos %= 4;
-        assert (pos != 4);
-    }
-}
diff --git a/gcc/testsuite/gdc.dg/imports/gdc36.d b/gcc/testsuite/gdc.dg/imports/gdc36.d
deleted file mode 100644 (file)
index a22fd6f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-module imports.gdc36;
-
-private import gdc36;
-
-void test36d_1()
-{
-    auto parser = Parser!(char[])();
-}
diff --git a/gcc/testsuite/gdc.dg/init1.d b/gcc/testsuite/gdc.dg/init1.d
deleted file mode 100644 (file)
index 679ad15..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-// { dg-do run { target hw } }
-// { dg-options "-fno-druntime" }
-// 'a' should not be default initialized to -1.
-static char a = void;
-
-extern (C) void main()
-{
-    assert(a == 0);
-}
diff --git a/gcc/testsuite/gdc.dg/pr92309.d b/gcc/testsuite/gdc.dg/pr92309.d
deleted file mode 100644 (file)
index 01ebc40..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92309
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-union U
-{
-    struct
-    {
-        size_t a;
-        size_t b;
-        union
-        {
-            size_t c;
-            size_t d;
-        }
-    }
-}
-
-void main()
-{
-    U u;
-    assert(u.a == 0);
-    u.d = 1;
-    assert(u.a == 0);
-}
diff --git a/gcc/testsuite/gdc.dg/pr94424.d b/gcc/testsuite/gdc.dg/pr94424.d
deleted file mode 100644 (file)
index b9f9fac..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94424
-// { dg-additional-options "-fmain -funittest" }
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-@safe unittest
-{
-    struct C
-    {
-        ubyte i;
-        this(ubyte i) { this.i = i; }
-    }
-
-    auto c1 = C(1);
-    auto c2 = C(2);
-
-    assert(__cmp([c1, c1][], [c2, c2][]) < 0);
-    assert(__cmp([c2, c2], [c1, c1]) > 0);
-    assert(__cmp([c2, c2], [c2, c1]) > 0);
-}
diff --git a/gcc/testsuite/gdc.dg/pr94777b.d b/gcc/testsuite/gdc.dg/pr94777b.d
deleted file mode 100644 (file)
index a230adb..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94777
-// { dg-additional-options "-fmain -funittest" }
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-void testVariadic(T)(int nargs, ...)
-{
-    import core.stdc.stdarg;
-    foreach(i; 0 .. nargs)
-    {
-        auto arg = va_arg!T(_argptr);
-        static if (__traits(compiles, arg.value))
-        {
-            assert(arg.value == i);
-        }
-        else static if (__traits(compiles, arg[0]))
-        {
-            foreach (value; arg)
-                assert(value == i);
-        }
-        else
-        {
-            assert(arg == T.init);
-        }
-    }
-}
-
-/******************************************/
-
-struct Constructor
-{
-    static int count;
-    int value;
-    this(int v) { count++; this.value = v; }
-}
-
-unittest
-{
-    auto a0 = Constructor(0);
-    auto a1 = Constructor(1);
-    auto a2 = Constructor(2);
-    testVariadic!Constructor(3, a0, a1, a2);
-    assert(Constructor.count == 3);
-}
-
-/******************************************/
-
-struct Postblit
-{
-    static int count = 0;
-    int value;
-    this(this) { count++; }
-}
-
-unittest
-{
-    auto a0 = Postblit(0);
-    auto a1 = Postblit(1);
-    auto a2 = Postblit(2);
-    testVariadic!Postblit(3, a0, a1, a2);
-    assert(Postblit.count == 3);
-}
-
-/******************************************/
-
-struct Destructor
-{
-    static int count = 0;
-    int value;
-    ~this() { count++; }
-}
-
-unittest
-{
-    {
-        auto a0 = Destructor(0);
-        auto a1 = Destructor(1);
-        auto a2 = Destructor(2);
-        static assert(!__traits(compiles, testVariadic!Destructor(3, a0, a1, a2)));
-    }
-    assert(Destructor.count == 3);
-}
-
-/******************************************/
-
-struct CopyConstructor 
-{
-    static int count = 0;
-    int value;
-    this(int v) { this.value = v; }
-    this(ref typeof(this) other) { count++; this.value = other.value; }
-}
-
-unittest
-{
-    auto a0 = CopyConstructor(0);
-    auto a1 = CopyConstructor(1);
-    auto a2 = CopyConstructor(2);
-    testVariadic!CopyConstructor(3, a0, a1, a2);
-    // NOTE: Cpctors are not implemented yet.
-    assert(CopyConstructor.count == 0 || CopyConstructor.count == 3);
-}
-
-/******************************************/
-
-unittest
-{
-    struct Nested
-    {
-        int value;
-    }
-
-    auto a0 = Nested(0);
-    auto a1 = Nested(1);
-    auto a2 = Nested(2);
-    testVariadic!Nested(3, a0, a1, a2);
-}
-
-/******************************************/
-
-unittest
-{
-    struct Nested2
-    {
-        int value;
-    }
-
-    void testVariadic2(int nargs, ...)
-    {
-        import core.stdc.stdarg;
-        foreach(i; 0 .. nargs)
-        {
-            auto arg = va_arg!Nested2(_argptr);
-            assert(arg.value == i);
-        }
-    }
-
-    auto a0 = Nested2(0);
-    auto a1 = Nested2(1);
-    auto a2 = Nested2(2);
-    testVariadic2(3, a0, a1, a2);
-}
-
-/******************************************/
-
-struct EmptyStruct
-{
-}
-
-unittest
-{
-    auto a0 = EmptyStruct();
-    auto a1 = EmptyStruct();
-    auto a2 = EmptyStruct();
-    testVariadic!EmptyStruct(3, a0, a1, a2);
-}
-
-/******************************************/
-
-alias StaticArray = int[4];
-
-unittest
-{
-    StaticArray a0 = 0;
-    StaticArray a1 = 1;
-    StaticArray a2 = 2;
-    // XBUG: Front-end rewrites static arrays as dynamic arrays.
-    //testVariadic!StaticArray(3, a0, a1, a2);
-}
-
-/******************************************/
-
-alias EmptyArray = void[0];
-
-unittest
-{
-    auto a0 = EmptyArray.init;
-    auto a1 = EmptyArray.init;
-    auto a2 = EmptyArray.init;
-    testVariadic!EmptyArray(3, a0, a1, a2);
-}
diff --git a/gcc/testsuite/gdc.dg/pr96152.d b/gcc/testsuite/gdc.dg/pr96152.d
deleted file mode 100644 (file)
index 3551614..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96152
-// { dg-additional-options "-fmain -funittest" }
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-auto assocArray(Keys, Values)(Keys keys, Values values)
-{
-    void* aa;
-    {
-        if (values.length > keys.length)
-            values = values[0 .. keys.length];
-        else if (keys.length > values.length)
-            keys = keys[0 .. values.length];
-        aa = aaLiteral(keys, values);
-    }
-    alias Key = typeof(keys[0]);
-    alias Value = typeof(values[0]);
-    return (() @trusted => cast(Value[Key]) aa)();
-}
-
-@safe unittest
-{
-    struct ThrowingElement
-    {
-        int i;
-        static bool b;
-        ~this(){
-            if (b)
-                throw new Exception("");
-        }
-    }
-    assert(assocArray([ThrowingElement()], [0]) == [ThrowingElement(): 0]);
-}
diff --git a/gcc/testsuite/gdc.dg/pr96153.d b/gcc/testsuite/gdc.dg/pr96153.d
deleted file mode 100644 (file)
index e1b8d81..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96153
-// { dg-additional-options "-fmain -funittest" }
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-struct Checked(T, Hook)
-{
-    private T payload;
-    Hook hook;
-
-    size_t toHash() const nothrow @safe
-    {
-        return hashOf(payload) ^ hashOf(hook);
-    }
-}
-
-Checked!(T, Hook) checked(Hook, T)(const T value)
-{
-    return Checked!(T, Hook)(value);
-}
-
-@system unittest
-{
-    static struct Hook1
-    {
-        uint var1 = uint.max;
-        uint var2 = uint.max;
-    }
-
-    assert(checked!Hook1(12).toHash() != checked!Hook1(13).toHash());
-    assert(checked!Hook1(13).toHash() == checked!Hook1(13).toHash());
-
-    static struct Hook2
-    {
-        uint var1 = uint.max;
-        ushort var2 = ushort.max;
-    }
-
-    assert(checked!Hook2(12).toHash() != checked!Hook2(13).toHash());
-    assert(checked!Hook2(13).toHash() == checked!Hook2(13).toHash());
-
-    static struct Hook3
-    {
-        ulong var1 = ulong.max;
-        uint var2 = uint.max;
-    }
-
-    assert(checked!Hook3(12).toHash() != checked!Hook3(13).toHash());
-    assert(checked!Hook3(13).toHash() == checked!Hook3(13).toHash());
-}
diff --git a/gcc/testsuite/gdc.dg/pr96156.d b/gcc/testsuite/gdc.dg/pr96156.d
deleted file mode 100644 (file)
index d9359b5..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96156
-// { dg-do run { target hw } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-struct S96156
-{
-    __gshared void* ptr;
-    int x;
-
-    this(int x) { ptr = &this; this.x = x; }
-    @disable this(this);
-}
-
-auto f96156()
-{
-    return g96156();
-}
-
-auto g96156()
-{
-    return h96156();
-}
-
-auto h96156()
-{
-    return S96156(100);
-}
-
-void main()
-{
-    auto s = f96156();
-    assert(&s == S96156.ptr);
-}
diff --git a/gcc/testsuite/gdc.dg/pr96157a.d b/gcc/testsuite/gdc.dg/pr96157a.d
deleted file mode 100644 (file)
index 11df19e..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96157
-// { dg-do run { target native } }
-// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
-
-struct S
-{
-    @disable this(this); // triggers nrvo
-    int v;
-}
-
-__gshared void* p;
-
-S[1000] foo() nothrow
-{
-    typeof(return) d;
-    p = &d;
-    return d;
-}
-
-void main()
-{
-    auto d = foo();
-    assert(p == &d);
-}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc115.d b/gcc/testsuite/gdc.dg/torture/gdc115.d
new file mode 100644 (file)
index 0000000..79693e8
--- /dev/null
@@ -0,0 +1,16 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=115
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void main()
+{
+    union U
+    {
+        float f;
+        uint i;
+    }
+    float a = 123.0;
+    const l = U(a);
+
+    assert(l.i == U(a).i);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc131.d b/gcc/testsuite/gdc.dg/torture/gdc131.d
new file mode 100644 (file)
index 0000000..63502ff
--- /dev/null
@@ -0,0 +1,15 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=131
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S131
+{
+    this(string ) { }
+    string opAssign(string v) { return v; }
+}
+
+void main()
+{
+    S131[string] s;
+    s["foo"] = "bar";
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc141.d b/gcc/testsuite/gdc.dg/torture/gdc141.d
new file mode 100644 (file)
index 0000000..315811c
--- /dev/null
@@ -0,0 +1,14 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=141
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+bool test141(int a)
+{
+    return a > (a + 1);
+}
+
+void main()
+{
+    assert(test141(int.min) == false);
+    assert(test141(int.max) == true);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc17.d b/gcc/testsuite/gdc.dg/torture/gdc17.d
new file mode 100644 (file)
index 0000000..cfc5694
--- /dev/null
@@ -0,0 +1,37 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=17
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+/**
+ * Parameters are not copied into a frame to be accessed from
+ * the method's __require function.
+ */
+void contractTest(string path)
+{
+    assert(path[0] == 't');
+    assert(path.length == 9);
+    assert(path[8] == 'i');
+}
+
+interface ModuleSaver
+{
+    void save(string str)
+    in
+    {
+        contractTest(str);
+    }
+}
+
+class ModuleWriter : ModuleSaver
+{
+    void save (string str)
+    in {}
+    do
+    {
+    }
+}
+
+void main()
+{
+  (new ModuleWriter()).save ("test.0.mci");
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc171.d b/gcc/testsuite/gdc.dg/torture/gdc171.d
new file mode 100644 (file)
index 0000000..a6c5ea6
--- /dev/null
@@ -0,0 +1,38 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=171
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void test171a()
+{
+    int count = 0;
+    short a = -1;
+    while (a != 0)
+    {
+        a >>>= 1;
+        count++;
+        assert(count <= 16);
+    }
+}
+
+void test171b()
+{
+    uint[3] lhs = [99, 201, 300],
+            rhs = [-1, 0, 0];
+    long t = 0;
+
+    for (int i = 0; i < 3; i++)
+    {
+        t += lhs[i];
+        t -= rhs[i];
+        lhs[i] = cast(uint) t;
+        t >>= uint.sizeof * 8;
+    }
+
+    assert(lhs == [100, 200, 300]);
+}
+
+void main()
+{
+    test171a();
+    test171b();
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc179.d b/gcc/testsuite/gdc.dg/torture/gdc179.d
new file mode 100644 (file)
index 0000000..a64ca7d
--- /dev/null
@@ -0,0 +1,32 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=179
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+import core.stdc.stdio;
+
+struct S179a
+{
+    @disable this(this);
+}
+
+struct S179b
+{
+    S179a s1;
+    void connect() { printf("this=%p\n", &this); }
+}
+
+class C179
+{
+    private S179b s2;
+    ref S179b value() @property
+    {
+        printf("this=%p\n", &s2);
+        return s2;
+    }
+}
+
+void main()
+{
+    C179 a = new C179;
+    a.value.connect();
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc186.d b/gcc/testsuite/gdc.dg/torture/gdc186.d
new file mode 100644 (file)
index 0000000..282167c
--- /dev/null
@@ -0,0 +1,60 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=186
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S186
+{
+    union
+    {
+        struct
+        {
+            ubyte fieldA;
+            byte  fieldB = -1;
+            byte fieldC = -1;
+        }
+        size_t _complete;
+    }
+
+    this(size_t complete)
+    {
+        this._complete = complete;
+    }
+}
+
+static if (size_t.sizeof == 8)
+    enum checkval = 0x0200000000000002;
+else
+    enum checkval = 0x02000002;
+
+void check186(in S186 obj, byte fieldB)
+{
+    assert(obj.fieldA == 2);
+    assert(obj.fieldB == 0);
+    assert(obj.fieldC == 0);
+    assert(obj._complete == checkval);
+    assert(fieldB == 0);
+}
+
+void test186(size_t val)
+{
+    S186 obj = S186(val);
+    check186(obj, obj.fieldB);
+
+    assert(obj.fieldA == 2);
+    assert(obj.fieldB == 0);
+    assert(obj.fieldC == 0);
+    assert(obj._complete == checkval);
+
+    obj = S186(val);
+    check186(obj, obj.fieldB);
+
+    assert(obj.fieldA == 2);
+    assert(obj.fieldB == 0);
+    assert(obj.fieldC == 0);
+    assert(obj._complete == checkval);
+}
+
+void main()
+{
+    test186(checkval);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc187.d b/gcc/testsuite/gdc.dg/torture/gdc187.d
new file mode 100644 (file)
index 0000000..60fbafc
--- /dev/null
@@ -0,0 +1,40 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=187
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+align(1) struct S187b
+{
+    align(1)
+    {
+        uint unpaddedA;
+        ushort unpaddedB;
+    }
+}
+
+struct S187a
+{
+    S187b[3] unpaddedArray;
+    ubyte wontInitialize = ubyte.init;
+}
+
+struct S187
+{
+    S187a interesting;
+}
+
+
+void prepareStack()
+{
+    byte[255] stackGarbage;
+    foreach(i, ref b; stackGarbage)
+    {
+        b  = cast(byte)(-i);
+    }
+}
+
+void main()
+{
+    prepareStack();
+    auto a = S187(S187a());
+    assert(a.interesting.wontInitialize == 0);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc191.d b/gcc/testsuite/gdc.dg/torture/gdc191.d
new file mode 100644 (file)
index 0000000..f414603
--- /dev/null
@@ -0,0 +1,201 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=191
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+class C191
+{
+    int count = 0;
+
+    void testA()
+    {
+        class Inner
+        {
+            void test()
+            {
+                void localFunction()
+                {
+                    if (++count != 5)
+                        testA();
+                }
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+
+    void testB()
+    {
+        class Inner
+        {
+            void test()
+            {
+                void localFunction()
+                {
+                    void anotherLocalFunction()
+                    {
+                        if (++count != 10)
+                            testB();
+                    }
+                    anotherLocalFunction();
+                }
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+
+    void testC()
+    {
+        class Inner
+        {
+            int a = 1;
+
+            void test()
+            {
+                void localFunction()
+                {
+                    count += a;
+                    if (count != 15)
+                        testC();
+                    assert(a == 1);
+                }
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+
+    void testD()
+    {
+        class Inner
+        {
+            void test()
+            {
+                int a = 1;
+
+                void localFunction()
+                {
+                    count += a;
+                    if (count != 20)
+                        testD();
+                    assert(a == 1);
+                }
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+
+    void testE()
+    {
+        class Inner
+        {
+            int a = 1;
+
+            void test()
+            {
+                void localFunction()
+                {
+                    void anotherLocalFunction()
+                    {
+                        count += a;
+                        if (count != 25)
+                            testE();
+                        assert(a == 1);
+                    }
+
+                    anotherLocalFunction();
+                }
+
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+
+    void testF()
+    {
+        class Inner
+        {
+            void test()
+            {
+                int a = 1;
+
+                void localFunction()
+                {
+                    void anotherLocalFunction()
+                    {
+                        count += a;
+                        if (count != 30)
+                            testF();
+                        assert(a == 1);
+                    }
+
+                    anotherLocalFunction();
+                }
+
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+
+    void testG()
+    {
+        class Inner
+        {
+            void test()
+            {
+                void localFunction()
+                {
+                    int a = 1;
+
+                    void anotherLocalFunction()
+                    {
+                        count += a;
+                        if (count != 35)
+                            testG();
+                        assert(a == 1);
+                    }
+
+                    anotherLocalFunction();
+                }
+
+                localFunction();
+            }
+        }
+        scope ic = new Inner();
+        ic.test();
+    }
+}
+
+void main()
+{
+    scope oc = new C191();
+    oc.testA();
+    assert(oc.count == 5);
+
+    oc.testB();
+    assert(oc.count == 10);
+
+    oc.testC();
+    assert(oc.count == 15);
+
+    oc.testD();
+    assert(oc.count == 20);
+
+    oc.testE();
+    assert(oc.count == 25);
+
+    oc.testF();
+    assert(oc.count == 30);
+
+    oc.testG();
+    assert(oc.count == 35);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc198.d b/gcc/testsuite/gdc.dg/torture/gdc198.d
new file mode 100644 (file)
index 0000000..144de61
--- /dev/null
@@ -0,0 +1,71 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=198
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S198a
+{
+    union
+    {
+        float[3] v;
+        struct
+        {
+            float x;
+            float y;
+            float z;
+        }
+    }
+
+    this(float x_, float y_, float z_)
+    {
+        x = x_;
+        y = y_;
+        z = z_;
+    }
+
+    ref S198a opOpAssign(string op)(S198a operand)
+    if (op == "+")
+    {
+        x += operand.x;
+        y += operand.y;
+        z += operand.z;
+        return this;
+    }
+}
+
+struct S198b
+{
+    @property get()
+    {
+        union Buf
+        {
+            void[0] result;
+        }
+        const Buf buf = { };
+        return buf.result;
+    }
+}
+
+struct S198c
+{
+    @property get()
+    {
+        union Buf
+        {
+            TypeInfo info;
+            void[0] result;
+        }
+        const Buf buf = { };
+        return buf.result;
+    }
+}
+
+
+void main()
+{
+    S198a sum = S198a(0, 0, 0);
+
+    foreach(size_t v; 0 .. 3)
+        sum += S198a(1, 2, 3);
+
+    assert(sum.v == [3, 6, 9]);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc200.d b/gcc/testsuite/gdc.dg/torture/gdc200.d
new file mode 100644 (file)
index 0000000..c41d8ea
--- /dev/null
@@ -0,0 +1,16 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=200
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void test200a(double x, double y)
+{
+  const double y2 = x + 1.0;
+  assert(y == y2);
+}
+
+void main()
+{
+  const double x = .012;
+  const double y = x + 1.0;
+  test200a(x, y);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc210.d b/gcc/testsuite/gdc.dg/torture/gdc210.d
new file mode 100644 (file)
index 0000000..7c7dad8
--- /dev/null
@@ -0,0 +1,62 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=210
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S210
+{
+    ubyte a;
+    uint b;
+}
+
+union U210
+{
+    S210 a;
+    uint b;
+}
+
+S210 test210a()
+{
+    S210 s = S210(1, 2);
+    return s;
+}
+
+S210[2] test210b()
+{
+    S210[2] s = [S210(1, 2), S210(3, 4)];
+    return s;
+}
+
+U210 test210c()
+{
+    U210 s = U210(S210(1, 2));
+    return s;
+}
+
+U210[2] test210d()
+{
+    U210[2] s = [U210(S210(1, 2)), U210(S210(3, 4))];
+    return s;
+}
+
+void main()
+{
+    S210 a = S210(1, 2);
+    assert(a == S210(1, 2));
+    assert(a == test210a());
+    assert(a != S210(2, 1));
+
+    S210[2] b = [S210(1, 2), S210(3, 4)];
+    assert(b == [S210(1, 2), S210(3, 4)]);
+    assert(b == test210b());
+    assert(b != [S210(2, 1), S210(3, 4)]);
+
+    U210 c = U210(S210(1, 2));
+    assert(c == U210(S210(1, 2)));
+    assert(c == test210c());
+    assert(c != U210(S210(2, 1)));
+
+    U210[2] d = [U210(S210(1, 2)), U210(S210(3, 4))];
+    assert(d == [U210(S210(1, 2)), U210(S210(3, 4))]);
+    assert(d == test210d());
+    assert(d != [U210(S210(2, 1)), U210(S210(3, 4))]);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc240.d b/gcc/testsuite/gdc.dg/torture/gdc240.d
new file mode 100644 (file)
index 0000000..d37f235
--- /dev/null
@@ -0,0 +1,16 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=240
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void test240(int a, int b)
+{
+    assert(a == 0);
+    assert(b == 0);
+}
+
+void main()
+{
+    int a = 0;
+    test240(a, a++);
+    assert(a == 1);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc242b.d b/gcc/testsuite/gdc.dg/torture/gdc242b.d
new file mode 100644 (file)
index 0000000..d707051
--- /dev/null
@@ -0,0 +1,25 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=242
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S242
+{
+    enum M = S242();
+    int a = 42;
+
+    auto iter()
+    {
+        this.a = 24;
+        return this;
+    }
+}
+
+S242 test242()
+{
+    return S242.M.iter;
+}
+
+void main()
+{
+    assert(test242() == S242(24));
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc248.d b/gcc/testsuite/gdc.dg/torture/gdc248.d
new file mode 100644 (file)
index 0000000..462b687
--- /dev/null
@@ -0,0 +1,44 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=248
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+class C248b
+{
+    bool isintegral()
+    {
+        return false;
+    }
+}
+
+class C248a
+{
+    int count = 0;
+
+    C248b getMemtype()
+    {
+        count++;
+        return new C248b();
+    }
+}
+
+class C248
+{
+    C248a sym;
+
+    this()
+    {
+        this.sym = new C248a();
+    }
+
+    bool isintegral()
+    {
+        return sym.getMemtype().isintegral();
+    }
+}
+
+void main()
+{
+    C248 e = new C248();
+    e.isintegral();
+    assert(e.sym.count == 1);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc250.d b/gcc/testsuite/gdc.dg/torture/gdc250.d
new file mode 100644 (file)
index 0000000..c5b7d60
--- /dev/null
@@ -0,0 +1,18 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=250
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void main()
+{
+    struct S
+    {
+        string data;
+    }
+
+    auto a = S("hello");
+    auto b = S("hello".dup);
+
+    assert(a.data == b.data);
+    assert(a == b);
+    assert([a] == [b]);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc273.d b/gcc/testsuite/gdc.dg/torture/gdc273.d
new file mode 100644 (file)
index 0000000..268d8d0
--- /dev/null
@@ -0,0 +1,19 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=273
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+class B273
+{
+    B273[] members;
+}
+
+class D273 : B273
+{
+}
+
+void main()
+{
+    auto noPointers = ClassInfo.ClassFlags.noPointers;
+    assert((B273.classinfo.m_flags & noPointers) == 0);
+    assert((D273.classinfo.m_flags & noPointers) == 0);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc283.d b/gcc/testsuite/gdc.dg/torture/gdc283.d
new file mode 100644 (file)
index 0000000..f7316f7
--- /dev/null
@@ -0,0 +1,103 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=283
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct Impl
+{
+    size_t _count;
+}
+
+struct RefCountedStore
+{
+    Impl* _store;
+
+    void initialize()
+    {
+        import core.stdc.stdlib : malloc;
+        _store = cast(Impl*) malloc(Impl.sizeof);
+        _store._count = 1;
+    }
+
+    bool isInitialized()
+    {
+        return _store !is null;
+    }
+
+    void ensureInitialized()
+    {
+        if (!isInitialized)
+            initialize();
+    }
+}
+
+struct RefCounted14443
+{
+    RefCountedStore _refCounted;
+
+    this(int)
+    {
+        _refCounted.initialize();
+    }
+
+    this(this)
+    {
+        ++_refCounted._store._count;
+    }
+
+    ~this()
+    {
+        if (--_refCounted._store._count)
+            return;
+
+        import core.stdc.stdlib : free;
+        free(_refCounted._store);
+        _refCounted._store = null;
+    }
+
+    int refCountedPayload()
+    {
+        _refCounted.ensureInitialized();
+        return 1;
+    }
+}
+
+struct PathRange14443
+{
+    RefCounted14443 path;
+
+    @property PathElement14443 front()
+    {
+        return PathElement14443(this, path.refCountedPayload());
+    }
+}
+
+struct PathElement14443
+{
+    PathRange14443 range;
+
+    this(PathRange14443 range, int)
+    {
+        this.range = range;
+    }
+}
+
+void main()
+{
+    auto path = RefCounted14443(12);
+    if (path._refCounted._store._count != 1)
+        assert(0);
+    {
+        auto _r = PathRange14443(path);
+        if (path._refCounted._store._count != 2)
+            assert(0);
+        {
+            auto element = _r.front;
+            if (path._refCounted._store._count != 3)
+                assert(0);
+        }
+        if (path._refCounted._store._count != 2)
+            assert(0);
+    }
+    if (path._refCounted._store._count != 1)
+        assert(0);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc285.d b/gcc/testsuite/gdc.dg/torture/gdc285.d
new file mode 100644 (file)
index 0000000..30ea373
--- /dev/null
@@ -0,0 +1,15 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=285
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+inout(char)[] test285(inout(char)* s) @nogc @system pure nothrow
+{
+    import core.stdc.string : strlen;
+    return s ? s[0 .. strlen(s)] : null;
+}
+
+void main()
+{
+    assert(test285(null) == null);
+    assert(test285("foo") == "foo");
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc286.d b/gcc/testsuite/gdc.dg/torture/gdc286.d
new file mode 100644 (file)
index 0000000..9b6bc65
--- /dev/null
@@ -0,0 +1,37 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=286
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void main()
+{
+    struct K286
+    {
+        int count;
+        this(this)
+        {
+            count++;
+        }
+    }
+
+    struct S286
+    {
+        int data;
+        this(K286 key)
+        {
+            data = key.count;
+        }
+    }
+
+    S286 getData(K286 key)
+    {
+        static S286[K286] getCache;
+        auto p = key in getCache;
+        if (p)
+            return *p;
+        return (getCache[key] = S286(key));
+    }
+
+    auto s = getData(K286());
+    if (s.data == 0)
+        assert(0);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc309.d b/gcc/testsuite/gdc.dg/torture/gdc309.d
new file mode 100644 (file)
index 0000000..d14634a
--- /dev/null
@@ -0,0 +1,41 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=309
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void main()
+{
+    creal f1 = +0.0 + 0.0i;
+    creal f2 = +0.0 - 0.0i;
+    creal f3 = -0.0 + 0.0i;
+    creal f4 = +0.0 + 0.0i;
+
+    assert(f1 !is f2);
+    assert(f1 !is f3);
+    assert(f2 !is f3);
+    assert(f1 is f4);
+
+    assert(!(f1 is f2));
+    assert(!(f1 is f3));
+    assert(!(f2 is f3));
+    assert(!(f1 !is f4));
+
+    struct CReal
+    {
+        creal value;
+    }
+
+    CReal s1 = CReal(+0.0 + 0.0i);
+    CReal s2 = CReal(+0.0 - 0.0i);
+    CReal s3 = CReal(-0.0 + 0.0i);
+    CReal s4 = CReal(+0.0 + 0.0i);
+
+    assert(s1 !is s2);
+    assert(s1 !is s3);
+    assert(s2 !is s3);
+    assert(s1 is s4);
+
+    assert(!(s1 is s2));
+    assert(!(s1 is s3));
+    assert(!(s2 is s3));
+    assert(!(s1 !is s4));
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc35.d b/gcc/testsuite/gdc.dg/torture/gdc35.d
new file mode 100644 (file)
index 0000000..111e056
--- /dev/null
@@ -0,0 +1,73 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=35
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+/**
+ * Here the BinaryHeap instance uses an alias parameter and therefore
+ * the instance's functions (percolateDown) need to be generated in
+ * topNIndex->BinaryHeap scope and not in the declaration scope
+ * (module->BinaryHeap).
+ */
+void topNIndex()()
+{
+    bool indirectLess(int a, int b)
+    {
+        return a > b;
+    }
+
+    auto a = BinaryHeap!(indirectLess)();
+}
+
+struct BinaryHeap(alias less)
+{
+    void percolateDown()
+    {
+        less(0, 1);
+    }
+}
+
+void test35a()
+{
+    topNIndex();
+}
+
+/*
+ * Similar as test35a but with an additional indirection.
+ * The nested function chain for percolateDown should look like this:
+ * topNIndex2->BinaryHeap2->percolateDown.
+ */
+void topNIndex2()()
+{
+    bool indirectLess(int a, int b)
+    {
+        return a > b;
+    }
+    auto a = BinaryHeap2!(S35b!(indirectLess)())();
+}
+
+struct S35b(alias a)
+{
+    void foo()
+    {
+        a(0, 0);
+    }
+}
+
+struct BinaryHeap2(alias less)
+{
+    void percolateDown()
+    {
+        less.foo();
+    }
+}
+
+void test35b()
+{
+    topNIndex2();
+}
+
+void main()
+{
+    test35a();
+    test35b();
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc36.d b/gcc/testsuite/gdc.dg/torture/gdc36.d
new file mode 100644 (file)
index 0000000..3adb7f2
--- /dev/null
@@ -0,0 +1,125 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=36
+// { dg-additional-sources "imports/gdc36.d" }
+// { dg-options "-I $srcdir/gdc.dg" }
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+module gdc36;
+
+import imports.gdc36;
+
+/**
+ * Here getChar is a function in a template where template.isnested == false
+ * but getChar still is a nested function and needs to get a static chain
+ * containing test36a.
+ */
+void test36a()(char val)
+{
+    void error()
+    {
+    }
+
+    void getChar()()
+    {
+        error();
+    }
+
+    void parseString()
+    {
+        getChar();
+    }
+}
+
+/**
+ * Similar as test36a, but a little more complicated:
+ * Here getChar is nested in a struct template which is nested in a function.
+ * getChar's static chain still needs to contain test36b.
+ */
+void test36b()(char val)
+{
+    void error()
+    {
+    }
+
+    struct S(T)
+    {
+        void getChar()
+        {
+            error();
+        }
+    }
+
+
+    void parseString()
+    {
+        S!(int)().getChar();
+    }
+}
+
+/**
+ * If g had accessed a, the frontend would have generated a closure.
+ *
+ * As we do not access it, there's no closure. We have to be careful
+ * not to set a static chain for g containing test36c_1 though,
+ * as g can be called from outside (here from test1c). In the end
+ * we have to treat this as if everything in test36c_1 was declared
+ * at module scope.
+ */
+auto test36c_1()
+{
+    int a;
+    void c() {}
+    class Result
+    {
+        int b;
+        void g() { c(); /*a = 42;*/ }
+    }
+
+    return new Result();
+}
+
+void test36c()
+{
+    test36c_1().g();
+}
+
+/**
+ * empty is a (private) function which is nested in lightPostprocess.
+ * At the same time it's a template instance, so it has to be declared as
+ * weak or otherwise one-only. imports/gdc36.d creates another instance
+ * of Regex!char to verify that.
+ */
+struct Parser(R)
+{
+    @property program()
+    {
+        return Regex!char();
+    }
+}
+
+struct Regex(Char)
+{
+    @trusted lightPostprocess()
+    {
+        struct FixedStack(T)
+        {
+            @property empty() { return false; }
+        }
+        auto counterRange = FixedStack!uint();
+    }
+}
+
+void test36d()
+{
+    auto parser = Parser!(char[])();
+    imports.gdc36.test36d_1;
+}
+
+void main()
+{
+  test36a('n');
+  test36b('n');
+  test36c();
+  test36d();
+}
+
diff --git a/gcc/testsuite/gdc.dg/torture/gdc51.d b/gcc/testsuite/gdc.dg/torture/gdc51.d
new file mode 100644 (file)
index 0000000..22f9bda
--- /dev/null
@@ -0,0 +1,29 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=51
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S51
+{
+    int x;
+    int pad;
+
+    this(this)
+    {
+        ++x;
+    }
+}
+
+void main()
+{
+    S51 s;
+    auto sarr = new S51[1];
+    auto sarr2 = sarr;
+
+    // postblit all fields.
+    sarr2 ~= s;
+
+    assert (sarr2[0].x == 1);
+    assert (sarr2[1].x == 1);
+    assert (sarr[0].x == 0);
+    assert (s.x == 0);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc57.d b/gcc/testsuite/gdc.dg/torture/gdc57.d
new file mode 100644 (file)
index 0000000..579067b
--- /dev/null
@@ -0,0 +1,21 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=57
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S57
+{
+    int a;
+    long b;
+    // Doesn't happen for bigger structs
+}
+
+S57 bar57()
+{
+    return S57(4, 42);
+}
+
+void main()
+{
+    S57 s = bar57();
+    assert (s is S57(4, 42));
+}
diff --git a/gcc/testsuite/gdc.dg/torture/gdc66.d b/gcc/testsuite/gdc.dg/torture/gdc66.d
new file mode 100644 (file)
index 0000000..a59bcf6
--- /dev/null
@@ -0,0 +1,14 @@
+// https://bugzilla.gdcproject.org/show_bug.cgi?id=66
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void main()
+{
+    int pos = 0;
+
+    foreach(x; 0 .. 64)
+    {
+        ++pos %= 4;
+        assert (pos != 4);
+    }
+}
diff --git a/gcc/testsuite/gdc.dg/torture/imports/gdc36.d b/gcc/testsuite/gdc.dg/torture/imports/gdc36.d
new file mode 100644 (file)
index 0000000..a22fd6f
--- /dev/null
@@ -0,0 +1,8 @@
+module imports.gdc36;
+
+private import gdc36;
+
+void test36d_1()
+{
+    auto parser = Parser!(char[])();
+}
diff --git a/gcc/testsuite/gdc.dg/torture/init1.d b/gcc/testsuite/gdc.dg/torture/init1.d
new file mode 100644 (file)
index 0000000..ce8c940
--- /dev/null
@@ -0,0 +1,9 @@
+// { dg-do run }
+// { dg-options "-fno-druntime" }
+// 'a' should not be default initialized to -1.
+static char a = void;
+
+extern (C) void main()
+{
+    assert(a == 0);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/pr92309.d b/gcc/testsuite/gdc.dg/torture/pr92309.d
new file mode 100644 (file)
index 0000000..03ff219
--- /dev/null
@@ -0,0 +1,25 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92309
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+union U
+{
+    struct
+    {
+        size_t a;
+        size_t b;
+        union
+        {
+            size_t c;
+            size_t d;
+        }
+    }
+}
+
+void main()
+{
+    U u;
+    assert(u.a == 0);
+    u.d = 1;
+    assert(u.a == 0);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/pr94424.d b/gcc/testsuite/gdc.dg/torture/pr94424.d
new file mode 100644 (file)
index 0000000..2910c9a
--- /dev/null
@@ -0,0 +1,19 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94424
+// { dg-additional-options "-fmain -funittest" }
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+@safe unittest
+{
+    struct C
+    {
+        ubyte i;
+        this(ubyte i) { this.i = i; }
+    }
+
+    auto c1 = C(1);
+    auto c2 = C(2);
+
+    assert(__cmp([c1, c1][], [c2, c2][]) < 0);
+    assert(__cmp([c2, c2], [c1, c1]) > 0);
+    assert(__cmp([c2, c2], [c2, c1]) > 0);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/pr94777b.d b/gcc/testsuite/gdc.dg/torture/pr94777b.d
new file mode 100644 (file)
index 0000000..2f0f9d9
--- /dev/null
@@ -0,0 +1,181 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94777
+// { dg-additional-options "-fmain -funittest" }
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+void testVariadic(T)(int nargs, ...)
+{
+    import core.stdc.stdarg;
+    foreach(i; 0 .. nargs)
+    {
+        auto arg = va_arg!T(_argptr);
+        static if (__traits(compiles, arg.value))
+        {
+            assert(arg.value == i);
+        }
+        else static if (__traits(compiles, arg[0]))
+        {
+            foreach (value; arg)
+                assert(value == i);
+        }
+        else
+        {
+            assert(arg == T.init);
+        }
+    }
+}
+
+/******************************************/
+
+struct Constructor
+{
+    static int count;
+    int value;
+    this(int v) { count++; this.value = v; }
+}
+
+unittest
+{
+    auto a0 = Constructor(0);
+    auto a1 = Constructor(1);
+    auto a2 = Constructor(2);
+    testVariadic!Constructor(3, a0, a1, a2);
+    assert(Constructor.count == 3);
+}
+
+/******************************************/
+
+struct Postblit
+{
+    static int count = 0;
+    int value;
+    this(this) { count++; }
+}
+
+unittest
+{
+    auto a0 = Postblit(0);
+    auto a1 = Postblit(1);
+    auto a2 = Postblit(2);
+    testVariadic!Postblit(3, a0, a1, a2);
+    assert(Postblit.count == 3);
+}
+
+/******************************************/
+
+struct Destructor
+{
+    static int count = 0;
+    int value;
+    ~this() { count++; }
+}
+
+unittest
+{
+    {
+        auto a0 = Destructor(0);
+        auto a1 = Destructor(1);
+        auto a2 = Destructor(2);
+        static assert(!__traits(compiles, testVariadic!Destructor(3, a0, a1, a2)));
+    }
+    assert(Destructor.count == 3);
+}
+
+/******************************************/
+
+struct CopyConstructor 
+{
+    static int count = 0;
+    int value;
+    this(int v) { this.value = v; }
+    this(ref typeof(this) other) { count++; this.value = other.value; }
+}
+
+unittest
+{
+    auto a0 = CopyConstructor(0);
+    auto a1 = CopyConstructor(1);
+    auto a2 = CopyConstructor(2);
+    testVariadic!CopyConstructor(3, a0, a1, a2);
+    // NOTE: Cpctors are not implemented yet.
+    assert(CopyConstructor.count == 0 || CopyConstructor.count == 3);
+}
+
+/******************************************/
+
+unittest
+{
+    struct Nested
+    {
+        int value;
+    }
+
+    auto a0 = Nested(0);
+    auto a1 = Nested(1);
+    auto a2 = Nested(2);
+    testVariadic!Nested(3, a0, a1, a2);
+}
+
+/******************************************/
+
+unittest
+{
+    struct Nested2
+    {
+        int value;
+    }
+
+    void testVariadic2(int nargs, ...)
+    {
+        import core.stdc.stdarg;
+        foreach(i; 0 .. nargs)
+        {
+            auto arg = va_arg!Nested2(_argptr);
+            assert(arg.value == i);
+        }
+    }
+
+    auto a0 = Nested2(0);
+    auto a1 = Nested2(1);
+    auto a2 = Nested2(2);
+    testVariadic2(3, a0, a1, a2);
+}
+
+/******************************************/
+
+struct EmptyStruct
+{
+}
+
+unittest
+{
+    auto a0 = EmptyStruct();
+    auto a1 = EmptyStruct();
+    auto a2 = EmptyStruct();
+    testVariadic!EmptyStruct(3, a0, a1, a2);
+}
+
+/******************************************/
+
+alias StaticArray = int[4];
+
+unittest
+{
+    StaticArray a0 = 0;
+    StaticArray a1 = 1;
+    StaticArray a2 = 2;
+    // XBUG: Front-end rewrites static arrays as dynamic arrays.
+    //testVariadic!StaticArray(3, a0, a1, a2);
+}
+
+/******************************************/
+
+alias EmptyArray = void[0];
+
+unittest
+{
+    auto a0 = EmptyArray.init;
+    auto a1 = EmptyArray.init;
+    auto a2 = EmptyArray.init;
+    testVariadic!EmptyArray(3, a0, a1, a2);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/pr96152.d b/gcc/testsuite/gdc.dg/torture/pr96152.d
new file mode 100644 (file)
index 0000000..86d3f91
--- /dev/null
@@ -0,0 +1,32 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96152
+// { dg-additional-options "-fmain -funittest" }
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+auto assocArray(Keys, Values)(Keys keys, Values values)
+{
+    void* aa;
+    {
+        if (values.length > keys.length)
+            values = values[0 .. keys.length];
+        else if (keys.length > values.length)
+            keys = keys[0 .. values.length];
+        aa = aaLiteral(keys, values);
+    }
+    alias Key = typeof(keys[0]);
+    alias Value = typeof(values[0]);
+    return (() @trusted => cast(Value[Key]) aa)();
+}
+
+@safe unittest
+{
+    struct ThrowingElement
+    {
+        int i;
+        static bool b;
+        ~this(){
+            if (b)
+                throw new Exception("");
+        }
+    }
+    assert(assocArray([ThrowingElement()], [0]) == [ThrowingElement(): 0]);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/pr96153.d b/gcc/testsuite/gdc.dg/torture/pr96153.d
new file mode 100644 (file)
index 0000000..c52b99a
--- /dev/null
@@ -0,0 +1,49 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96153
+// { dg-additional-options "-fmain -funittest" }
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+struct Checked(T, Hook)
+{
+    private T payload;
+    Hook hook;
+
+    size_t toHash() const nothrow @safe
+    {
+        return hashOf(payload) ^ hashOf(hook);
+    }
+}
+
+Checked!(T, Hook) checked(Hook, T)(const T value)
+{
+    return Checked!(T, Hook)(value);
+}
+
+@system unittest
+{
+    static struct Hook1
+    {
+        uint var1 = uint.max;
+        uint var2 = uint.max;
+    }
+
+    assert(checked!Hook1(12).toHash() != checked!Hook1(13).toHash());
+    assert(checked!Hook1(13).toHash() == checked!Hook1(13).toHash());
+
+    static struct Hook2
+    {
+        uint var1 = uint.max;
+        ushort var2 = ushort.max;
+    }
+
+    assert(checked!Hook2(12).toHash() != checked!Hook2(13).toHash());
+    assert(checked!Hook2(13).toHash() == checked!Hook2(13).toHash());
+
+    static struct Hook3
+    {
+        ulong var1 = ulong.max;
+        uint var2 = uint.max;
+    }
+
+    assert(checked!Hook3(12).toHash() != checked!Hook3(13).toHash());
+    assert(checked!Hook3(13).toHash() == checked!Hook3(13).toHash());
+}
diff --git a/gcc/testsuite/gdc.dg/torture/pr96156.d b/gcc/testsuite/gdc.dg/torture/pr96156.d
new file mode 100644 (file)
index 0000000..ac48394
--- /dev/null
@@ -0,0 +1,33 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96156
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S96156
+{
+    __gshared void* ptr;
+    int x;
+
+    this(int x) { ptr = &this; this.x = x; }
+    @disable this(this);
+}
+
+auto f96156()
+{
+    return g96156();
+}
+
+auto g96156()
+{
+    return h96156();
+}
+
+auto h96156()
+{
+    return S96156(100);
+}
+
+void main()
+{
+    auto s = f96156();
+    assert(&s == S96156.ptr);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/pr96157a.d b/gcc/testsuite/gdc.dg/torture/pr96157a.d
new file mode 100644 (file)
index 0000000..0e9019c
--- /dev/null
@@ -0,0 +1,24 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96157
+// { dg-do run }
+// { dg-skip-if "needs gcc/config.d" { ! d_runtime } }
+
+struct S
+{
+    @disable this(this); // triggers nrvo
+    int v;
+}
+
+__gshared void* p;
+
+S[1000] foo() nothrow
+{
+    typeof(return) d;
+    p = &d;
+    return d;
+}
+
+void main()
+{
+    auto d = foo();
+    assert(p == &d);
+}
diff --git a/gcc/testsuite/gdc.dg/torture/torture.exp b/gcc/testsuite/gdc.dg/torture/torture.exp
new file mode 100644 (file)
index 0000000..d498818
--- /dev/null
@@ -0,0 +1,50 @@
+#   Copyright (C) 2020 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# This harness is for tests that should be run at all optimisation levels.
+
+# Load support procs.
+load_lib gdc-dg.exp
+
+# The default option list can be overridden by
+# TORTURE_OPTIONS="{ { list1 } ... { listN } }"
+
+if ![info exists TORTURE_OPTIONS] {
+    set TORTURE_OPTIONS [list \
+       { -O0 } { -O1 } { -O2 } { -O3 } { -Os } \
+       { -O0 -frelease } { -O0 -g } { -O0 -frelease -g } \
+       { -O1 -frelease } { -O1 -g } { -O1 -frelease -g } \
+       { -O2 -frelease } { -O2 -g } { -O2 -frelease -g } \
+       { -O3 -frelease } { -O3 -g } { -O3 -frelease -g } \
+       { -Os -frelease } { -Os -g } { -Os -frelease -g }]
+}
+
+# Initialize `dg'.
+dg-init
+
+# Initialize use of torture lists.
+torture-init
+set-torture-options $TORTURE_OPTIONS
+
+# Main loop.
+gdc-dg-runtest [lsort \
+       [glob -nocomplain $srcdir/$subdir/*.d ] ] "" ""
+
+# Finalize use of torture lists.
+torture-finish
+
+# All done.
+dg-finish