[D] Merge upstream dmd cd2034cd7
authorIain Buclaw <ibuclaw@gdcproject.org>
Mon, 14 Jan 2019 10:38:00 +0000 (10:38 +0000)
committerIain Buclaw <ibuclaw@gcc.gnu.org>
Mon, 14 Jan 2019 10:38:00 +0000 (10:38 +0000)
One fix in the asm statement parser to stop parsing if the end of the
statement has been reached, and moves all inline asm tests to gdc.dg.
These being adjusted where necessary to test the GCC style instead.

gcc/testsuite/ChangeLog:

2019-01-14  Iain Buclaw  <ibuclaw@gdcproject.org>

* gdc.dg/asm1.d: New test.
* gdc.dg/asm2.d: New test.
* gdc.dg/asm3.d: New test.
* gdc.dg/asm4.d: New test.
* lib/gdc.exp (gdc_init): Set gcc_error_prefix and gcc_warning_prefix.

From-SVN: r267913

39 files changed:
gcc/d/dmd/MERGE
gcc/d/dmd/iasmgcc.c
gcc/testsuite/ChangeLog
gcc/testsuite/gdc.dg/asm1.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/asm2.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/asm3.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/asm4.d [new file with mode: 0644]
gcc/testsuite/gdc.test/compilable/deprecate12979a.d [deleted file]
gcc/testsuite/gdc.test/compilable/iasm_labeloperand.d [deleted file]
gcc/testsuite/gdc.test/compilable/test11471.d [deleted file]
gcc/testsuite/gdc.test/compilable/test12979a.d [deleted file]
gcc/testsuite/gdc.test/compilable/test12979b.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/deprecate12979a.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/deprecate12979b.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/deprecate12979c.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/deprecate12979d.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/diag6717.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/fail12635.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/fail13938.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/fail13939.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/fail14009.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/fail152.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/fail2350.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/fail274.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/fail327.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/fail3354.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/fail353.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/fail8168.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/ice15239.d [deleted file]
gcc/testsuite/gdc.test/fail_compilation/test12979.d [deleted file]
gcc/testsuite/gdc.test/runnable/argufilem.d [deleted file]
gcc/testsuite/gdc.test/runnable/ctorpowtests.d
gcc/testsuite/gdc.test/runnable/imports/argufile.d [deleted file]
gcc/testsuite/gdc.test/runnable/test23.d
gcc/testsuite/gdc.test/runnable/test34.d
gcc/testsuite/gdc.test/runnable/test36.d [deleted file]
gcc/testsuite/gdc.test/runnable/test42.d
gcc/testsuite/gdc.test/runnable/testsafe.d
gcc/testsuite/lib/gdc.exp

index feb65923273a04c1c62539c0d35cedf2e2dec1bd..a3b2db74af4c2b47437769fdcd4f376ba8a2739e 100644 (file)
@@ -1,4 +1,4 @@
-6d5b853d30908638d49210ebe600917296b8ab9b
+cd2034cd7b157dd8f3e94c684061bb1aa630b2b6
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/dmd repository.
index 3c0494d5717c673c864eb0045635ae14226501f5..cecbdefe41a0abda6cd8520ed1fe588c9f35cc62 100644 (file)
@@ -224,7 +224,7 @@ Lerror:
 static GccAsmStatement *parseGccAsm(Parser *p, GccAsmStatement *s)
 {
     s->insn = p->parseExpression();
-    if (p->token.value == TOKsemicolon)
+    if (p->token.value == TOKsemicolon || p->token.value == TOKeof)
         goto Ldone;
 
     // No semicolon followed after instruction template, treat as extended asm.
@@ -254,7 +254,7 @@ static GccAsmStatement *parseGccAsm(Parser *p, GccAsmStatement *s)
                 assert(0);
         }
 
-        if (p->token.value == TOKsemicolon)
+        if (p->token.value == TOKsemicolon || p->token.value == TOKeof)
             goto Ldone;
     }
 Ldone:
@@ -288,6 +288,7 @@ Statement *gccAsmSemantic(GccAsmStatement *s, Scope *sc)
         *ptoklist = NULL;
     }
     p.token = *toklist;
+    p.scanloc = s->loc;
 
     // Parse the gcc asm statement.
     s = parseGccAsm(&p, s);
index d0611e3bc37b7b39a50715762b7f1069eab0779b..373f39d2a8b2bc1c4b1de426ff98cdbf690eb787 100644 (file)
@@ -1,3 +1,11 @@
+2019-01-14  Iain Buclaw  <ibuclaw@gdcproject.org>
+
+       * gdc.dg/asm1.d: New test.
+       * gdc.dg/asm2.d: New test.
+       * gdc.dg/asm3.d: New test.
+       * gdc.dg/asm4.d: New test.
+       * lib/gdc.exp (gdc_init): Set gcc_error_prefix and gcc_warning_prefix.
+
 2019-01-13  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libfortran/88776
diff --git a/gcc/testsuite/gdc.dg/asm1.d b/gcc/testsuite/gdc.dg/asm1.d
new file mode 100644 (file)
index 0000000..7b00e4d
--- /dev/null
@@ -0,0 +1,82 @@
+// { dg-do compile }
+module asm1;
+
+void parse1()
+{
+    asm
+    {
+        ""h;    // { dg-error "found 'h' when expecting ':'" }
+    }
+}
+
+void parse2()
+{
+    asm 
+    {
+        "" : : "g" 1 ? 2 : 3;
+        "" : : "g" 1 ? 2 : : 3;
+        // { dg-error "expression expected, not ':'" "" { target *-*-* } .-1 }
+        // { dg-error "expected constant string constraint for operand" "" { target *-*-* } .-2 }
+    }
+}
+
+void parse3()
+{
+    asm { "" [; }
+    // { dg-error "expression expected, not ';'" "" { target *-*-* } .-1 }
+    // { dg-error "found 'EOF' when expecting ','" "" { target *-*-* } .-2 }
+    // { dg-error "found 'EOF' when expecting ']'" "" { target *-*-* } .-3 }
+    // { dg-error "found 'EOF' when expecting ';'" "" { target *-*-* } .-4 }
+}
+
+void semantic1()
+{
+    {
+        int one;
+    L1:
+        ;
+    }
+    asm { "" : : : : L1, L2; }
+    // { dg-error "goto skips declaration of variable asm1.semantic1.one" "" { target *-*-* } .-1 }
+    // { dg-error "goto skips declaration of variable asm1.semantic1.two" "" { target *-*-* } .-2 }
+    {
+        int two;
+    L2:
+        ;
+    }
+}
+
+void semantic2a(X...)(X expr)
+{
+    alias X[0] var1;
+    asm { "%0" : "=m" var1; }   // { dg-error "double 'double' is a type, not an lvalue" }
+}
+
+void semantic2()
+{
+   semantic2a(3.6);     // { dg-error "template instance asm1.semantic2a!double error instantiating" }
+}
+
+void semantic3()
+{
+    asm 
+    {
+        unknown;        // { dg-error "undefined identifier" }
+    }
+}
+
+struct S4
+{
+    template opDispatch(string Name, P...)
+    {
+        static void opDispatch(P) {}
+    }
+}
+
+void semantic4()
+{
+    asm
+    {
+        "%0" : : "m" S4.foo;    // { dg-error "template instance opDispatch!\"foo\" has no value" }
+    }
+}
diff --git a/gcc/testsuite/gdc.dg/asm2.d b/gcc/testsuite/gdc.dg/asm2.d
new file mode 100644 (file)
index 0000000..bce0e41
--- /dev/null
@@ -0,0 +1,8 @@
+// { dg-do compile }
+module asm2;
+
+void test()
+{
+    asm const shared { }    // { dg-error "const/immutable/shared/inout attributes are not allowed on asm blocks" }
+}
+
diff --git a/gcc/testsuite/gdc.dg/asm3.d b/gcc/testsuite/gdc.dg/asm3.d
new file mode 100644 (file)
index 0000000..333d83e
--- /dev/null
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-options "-Wall -Wdeprecated -Werror" }
+module asm3;
+
+void test1() nothrow    // { dg-error "nothrow function 'asm3.test1' may throw" }
+{
+    asm { }             // { dg-error "asm statement is assumed to throw - mark it with 'nothrow' if it does not" }
+}
+
+void test2() pure
+{
+    asm { }             // { dg-error "asm statement is assumed to be impure - mark it with 'pure' if it is not" }
+}
+
+void test3() @nogc
+{
+    asm { }             // { dg-error "asm statement is assumed to use the GC - mark it with '@nogc' if it does not" }
+}
+
+void test4() @safe
+{
+    asm { }             // { dg-error "asm statement is assumed to be @system - mark it with '@trusted' if it is not" }
+}
+
diff --git a/gcc/testsuite/gdc.dg/asm4.d b/gcc/testsuite/gdc.dg/asm4.d
new file mode 100644 (file)
index 0000000..e243c08
--- /dev/null
@@ -0,0 +1,40 @@
+// https://issues.dlang.org/show_bug.cgi?id=12979
+// { dg-do compile }
+// { dg-options "-Wall -Wdeprecated -Werror" }
+module asm4;
+
+void test1()
+{
+    asm pure nothrow @nogc @trusted {}
+    asm @safe {}
+}
+
+void test2() pure nothrow @nogc @safe
+{
+    asm pure nothrow @nogc @trusted {}
+}
+
+void test3()()
+{
+    asm pure nothrow @nogc @trusted {}
+}
+
+static assert(__traits(compiles, () pure nothrow @nogc @safe => test3()));
+
+void test4()()
+{
+    asm {}
+}
+
+// wait for deprecation of asm pure inference
+// static assert(!__traits(compiles, () pure => test4()));
+static assert(!__traits(compiles, () nothrow => test4()));
+// wait for deprecation of asm @nogc inference
+// static assert(!__traits(compiles, () @nogc => test4()));
+static assert(!__traits(compiles, () @safe => test4()));
+
+@safe
+void test5()
+{
+    static assert(!__traits(compiles, { asm { ""; } }() ));
+}
diff --git a/gcc/testsuite/gdc.test/compilable/deprecate12979a.d b/gcc/testsuite/gdc.test/compilable/deprecate12979a.d
deleted file mode 100644 (file)
index afe919a..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// REQUIRED_ARGS: -dw
-// PERMUTE_ARGS:
-
-/*
-TEST_OUTPUT:
----
-compilable/deprecate12979a.d(13): Deprecation: asm statement is assumed to throw - mark it with `nothrow` if it does not
----
-*/
-
-void foo() nothrow
-{
-    version(GNU)
-    {
-        asm
-        {
-            "";
-        }
-    }
-    else
-    {
-        asm
-        {
-            ret;
-        }
-    }
-}
diff --git a/gcc/testsuite/gdc.test/compilable/iasm_labeloperand.d b/gcc/testsuite/gdc.test/compilable/iasm_labeloperand.d
deleted file mode 100644 (file)
index f88fd16..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-
-version (D_InlineAsm_X86)
-    version = TestInlineAsm;
-else version (D_InlineAsm_X86_64)
-    version = TestInlineAsm;
-else version (GNU)
-    version = TestInlineAsm;
-else
-    pragma(msg, "Inline asm not supported, not testing.");
-
-version (TestInlineAsm)
-{
-    void testInlineAsm()
-    {
-        version (GNU)
-        {
-        L1:
-            asm { ""; }
-            asm { "" : : : : L1, L2; }
-        L2:
-            asm { ""; }
-        }
-        else
-        {
-            asm
-            {
-               L1:
-                       nop;
-                       nop;
-                       nop;
-                       nop;
-                       
-                       mov EAX, dword ptr L1; // Check back references
-                       mov EAX, dword ptr L2; // Check forward references
-                       mov EAX, dword ptr DS:L1; // Not really useful in standard use, but who knows.
-                       mov EAX, dword ptr FS:L2; // Once again, not really useful, but it is valid.
-                       mov EAX, dword ptr CS:L1; // This is what the first test case should implicitly be.
-                       
-               L2:
-                       nop;
-                       nop;
-                       nop;
-                       nop;
-                       
-            }
-        }
-    }
-}
diff --git a/gcc/testsuite/gdc.test/compilable/test11471.d b/gcc/testsuite/gdc.test/compilable/test11471.d
deleted file mode 100644 (file)
index 1df7e80..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-// REQUIRED_ARGS: -profile
-
-void main() nothrow
-{
-    // Error: asm statements are assumed to throw
-    version(GNU)
-        asm { ""; }
-    else
-        asm { nop; }
-}
diff --git a/gcc/testsuite/gdc.test/compilable/test12979a.d b/gcc/testsuite/gdc.test/compilable/test12979a.d
deleted file mode 100644 (file)
index 14ca6ef..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-void parse()
-{
-    asm pure nothrow @nogc @trusted {}
-    asm @safe {}
-}
diff --git a/gcc/testsuite/gdc.test/compilable/test12979b.d b/gcc/testsuite/gdc.test/compilable/test12979b.d
deleted file mode 100644 (file)
index 41c76a2..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// REQUIRED_ARGS: -w -de
-
-void foo() pure nothrow @nogc @safe
-{
-    version(GNU)
-    {
-        asm pure nothrow @nogc @trusted
-        {
-            "";
-        }
-    }
-    else
-    {
-        asm pure nothrow @nogc @trusted
-        {
-            ret;
-        }
-    }
-}
-
-void bar()()
-{
-    version(GNU)
-    {
-        asm pure nothrow @nogc @trusted
-        {
-            "";
-        }
-    }
-    else
-    {
-        asm pure nothrow @nogc @trusted
-        {
-            ret;
-        }
-    }
-}
-
-static assert(__traits(compiles, () pure nothrow @nogc @safe => bar()));
-
-void baz()()
-{
-    version(GNU)
-    {
-        asm
-        {
-            "";
-        }
-    }
-    else
-    {
-        asm
-        {
-            ret;
-        }
-    }
-}
-
-// wait for deprecation of asm pure inference
-// static assert(!__traits(compiles, () pure => baz()));
-static assert(!__traits(compiles, () nothrow => baz()));
-// wait for deprecation of asm @nogc inference
-// static assert(!__traits(compiles, () @nogc => baz()));
-static assert(!__traits(compiles, () @safe => baz()));
diff --git a/gcc/testsuite/gdc.test/fail_compilation/deprecate12979a.d b/gcc/testsuite/gdc.test/fail_compilation/deprecate12979a.d
deleted file mode 100644 (file)
index 5b2cd56..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// REQUIRED_ARGS: -de
-// PERMUTE_ARGS:
-
-/*
-TEST_OUTPUT:
----
-fail_compilation/deprecate12979a.d(14): Deprecation: asm statement is assumed to throw - mark it with `nothrow` if it does not
-fail_compilation/deprecate12979a.d(12): Error: nothrow function `deprecate12979a.foo` may throw
----
-*/
-
-void foo() nothrow
-{
-    asm
-    {
-        ret;
-    }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/deprecate12979b.d b/gcc/testsuite/gdc.test/fail_compilation/deprecate12979b.d
deleted file mode 100644 (file)
index 0d675cb..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// REQUIRED_ARGS: -de
-// PERMUTE_ARGS:
-
-/*
-TEST_OUTPUT:
----
-fail_compilation/deprecate12979b.d(13): Deprecation: asm statement is assumed to be impure - mark it with 'pure' if it is not
----
-*/
-
-void foo() pure
-{
-    asm
-    {
-        ret;
-    }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/deprecate12979c.d b/gcc/testsuite/gdc.test/fail_compilation/deprecate12979c.d
deleted file mode 100644 (file)
index 7827004..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// REQUIRED_ARGS: -de
-// PERMUTE_ARGS:
-
-/*
-TEST_OUTPUT:
----
-fail_compilation/deprecate12979c.d(13): Deprecation: asm statement is assumed to use the GC - mark it with '@nogc' if it does not
----
-*/
-
-void foo() @nogc
-{
-    asm
-    {
-        ret;
-    }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/deprecate12979d.d b/gcc/testsuite/gdc.test/fail_compilation/deprecate12979d.d
deleted file mode 100644 (file)
index afff567..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// PERMUTE_ARGS:
-
-/*
-TEST_OUTPUT:
----
-fail_compilation/deprecate12979d.d(12): Error: asm statement is assumed to be @system - mark it with '@trusted' if it is not
----
-*/
-
-void foo() @safe
-{
-    asm
-    {
-        ret;
-    }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/diag6717.d b/gcc/testsuite/gdc.test/fail_compilation/diag6717.d
deleted file mode 100644 (file)
index fe30f89..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
-TEST_OUTPUT:
----
-fail_compilation/diag6717.d(12): Error: end of instruction expected, not 'h'
----
-*/
-
-void main()
-{
-    asm
-    {
-        mov AX, 12h ;
-    }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail12635.d b/gcc/testsuite/gdc.test/fail_compilation/fail12635.d
deleted file mode 100644 (file)
index b00cc47..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
-TEST_OUTPUT:
----
-fail_compilation/fail12635.d(19): Error: Cannot generate a segment prefix for a branching instruction
----
-*/
-
-void foo()
-{
-    enum NOP = 0x9090_9090_9090_9090;
-
-    asm
-    {
-    L1:
-        dq NOP,NOP,NOP,NOP;    //  32
-        dq NOP,NOP,NOP,NOP;    //  64
-        dq NOP,NOP,NOP,NOP;    //  96
-        dq NOP,NOP,NOP,NOP;    // 128
-        jmp DS:L1;
-    }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13938.d b/gcc/testsuite/gdc.test/fail_compilation/fail13938.d
deleted file mode 100644 (file)
index bd18ef2..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// REQUIRED_ARGS: -o-
-/*
-TEST_OUTPUT:
----
-fail_compilation/fail13938.d(14): Error: cannot directly load TLS variable 'val'
----
-*/
-
-void test1()
-{
-    static int val;
-    asm
-    {
-        mov EAX, val;
-    }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail13939.d b/gcc/testsuite/gdc.test/fail_compilation/fail13939.d
deleted file mode 100644 (file)
index 074c22c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-// REQUIRED_ARGS: -o- -fPIC
-// DISABLED: win32 win64
-/*
-TEST_OUTPUT:
----
-fail_compilation/fail13939.d(15): Error: cannot directly load global variable 'val' with PIC code
----
-*/
-version(Windows) static assert(0);
-void test1()
-{
-    __gshared int val;
-    asm
-    {
-        mov EAX, val;
-    }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail14009.d b/gcc/testsuite/gdc.test/fail_compilation/fail14009.d
deleted file mode 100644 (file)
index 84f72c2..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
-TEST_OUTPUT:
----
-fail_compilation/fail14009.d(12): Error: expression expected not :
----
-*/
-
-void main()
-{
-    asm {
-      mov EAX, FS: 1 ? 2 : 3;     // accepted
-      mov EAX, FS: 1 ? 2 : : 3;   // rejected
-    }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail152.d b/gcc/testsuite/gdc.test/fail_compilation/fail152.d
deleted file mode 100644 (file)
index 60cf4ce..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-TEST_OUTPUT:
----
-fail_compilation/fail152.d(15): Error: cannot use type double as an operand
----
-*/
-
-// 1028 Segfault using tuple inside asm code.
-
-void a(X...)(X expr)
-{
-    alias X[0] var1;
-    version(GNU)
-    {
-        version(X86) asm {"fstpd %0;" : "=m" (var1) : : ;}
-        else version(X86_64) asm {"fstpd %0;" : "=m" (var1) : : ;}
-        else static assert(false, "ASM code not implemented for this architecture");
-    }
-    else asm {
-        //fld double ptr X[0];   // (1) segfaults
-        fstp double ptr var1;    // (2) ICE
-    }
-}
-
-void main()
-{
-   a(3.6);
-}
-
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail2350.d b/gcc/testsuite/gdc.test/fail_compilation/fail2350.d
deleted file mode 100644 (file)
index deb0ceb..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
-TEST_OUTPUT:
----
-fail_compilation/fail2350.d(8): Error: function fail2350.test2350 naked assembly functions with contracts are not supported
----
-*/
-
-void test2350()
-in
-{
-}
-body
-{
-       asm { naked; }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail274.d b/gcc/testsuite/gdc.test/fail_compilation/fail274.d
deleted file mode 100644 (file)
index 5fa5596..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-TEST_OUTPUT:
----
-fail_compilation/fail274.d(10): Error: expression expected not ;
----
-*/
-
-void main()
-{
-    asm { inc [; }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail327.d b/gcc/testsuite/gdc.test/fail_compilation/fail327.d
deleted file mode 100644 (file)
index ab87235..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
-TEST_OUTPUT:
----
-fail_compilation/fail327.d(10): Error: asm statement is assumed to be @system - mark it with '@trusted' if it is not
----
-*/
-
-@safe void foo()
-{
-    version(GNU)
-    {
-        version(X86) asm {"xor %%EAX,%%EAX" : : : ;}
-        else version(X86_64) asm {"xor %%EAX,%%EAX" : : : ;}
-        else static assert(false, "ASM code not implemented for this architecture");
-    }
-    else asm { xor EAX,EAX; }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail3354.d b/gcc/testsuite/gdc.test/fail_compilation/fail3354.d
deleted file mode 100644 (file)
index bcf6368..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-
-void main()
-{
-    version(D_InlineAsm_X86) {}
-    else version(D_InlineAsm_X64) {}
-    else static assert(0);
-
-    asm {
-        fldz ST(0), ST(1), ST(2), ST(3);
-        fld ST(0), ST(1), ST(2), ST(3);
-    }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail353.d b/gcc/testsuite/gdc.test/fail_compilation/fail353.d
deleted file mode 100644 (file)
index 56cda77..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-TEST_OUTPUT:
----
-block displacement of -130 exceeds the maximum offset of -128 to 127.
----
-*/
-
-void foo()
-{
-    enum NOP = 0x9090_9090_9090_9090;
-
-    version(GNU)
-    {
-        version(X86) asm {
-            "L1:"
-            "dq %0,%0,%0,%0;"
-            "dq %0,%0,%0,%0;"
-            "dq %0,%0,%0,%0;"
-            "dq %0,%0,%0,%0;"
-            "loop L1;" : "n" (NOP) : : ;
-        }
-        else version(X86_64) asm {
-            "L1:"
-            "dq %0,%0,%0,%0;"
-            "dq %0,%0,%0,%0;"
-            "dq %0,%0,%0,%0;"
-            "dq %0,%0,%0,%0;"
-            "loop L1;" : "n" (NOP) : : ;
-        }
-        else static assert(false, "ASM code not implemented for this architecture");
-    }
-    else asm
-    {
-    L1:
-        dq NOP,NOP,NOP,NOP;    //  32
-        dq NOP,NOP,NOP,NOP;    //  64
-        dq NOP,NOP,NOP,NOP;    //  96
-        dq NOP,NOP,NOP,NOP;    // 128
-        // unnoticed signed underflow of rel8 with DMD2.056
-        loop L1;
-    }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail8168.d b/gcc/testsuite/gdc.test/fail_compilation/fail8168.d
deleted file mode 100644 (file)
index ed1c307..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-void main() {
-    asm {
-        unknown; // wrong opcode
-    }
-}
-
diff --git a/gcc/testsuite/gdc.test/fail_compilation/ice15239.d b/gcc/testsuite/gdc.test/fail_compilation/ice15239.d
deleted file mode 100644 (file)
index 6512d85..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-TEST_OUTPUT:
----
-fail_compilation/ice15239.d(21): Error: cannot interpret opDispatch!"foo" at compile time
-fail_compilation/ice15239.d(21): Error: bad type/size of operands '__error'
----
-*/
-
-struct T
-{
-    template opDispatch(string Name, P...)
-    {
-        static void opDispatch(P) {}
-    }
-}
-
-void main()
-{
-    asm
-    {
-        call T.foo;
-    }
-}
diff --git a/gcc/testsuite/gdc.test/fail_compilation/test12979.d b/gcc/testsuite/gdc.test/fail_compilation/test12979.d
deleted file mode 100644 (file)
index 95cd3aa..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-// PERMUTE_ARGS:
-
-/*
-TEST_OUTPUT:
----
-fail_compilation/test12979.d(13): Error: const/immutable/shared/inout attributes are not allowed on `asm` blocks
----
-*/
-
-void foo()
-{
-    asm const shared
-    {
-        ret;
-    }
-}
diff --git a/gcc/testsuite/gdc.test/runnable/argufilem.d b/gcc/testsuite/gdc.test/runnable/argufilem.d
deleted file mode 100644 (file)
index 44d6270..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-// EXTRA_SOURCES: imports/argufile.d
-
-// NOTE: The bug only works when main.d and argufile.d are put in
-//                      separate files and compiled like 'dmd main.d argufile.d'
-//                      Also, I'm sure writefln is causing the crash cause when I
-//                      use printf(), it doesn't crash.
-
-// main.d -------------------------------------------------------
-
-import argufile;
-
-int main(string[] args)
-{
-        string message = arguments("bob is ", 7, " years old");
-
-        writefln(message);
-
-        argufile.useargs(); // will crash here
-
-        return 0;
-}
-
index 2fb458e44f14d37bb943981c89892ff589a70274..b193d3b1e028701d6a9fb8462a253aef0ac31ff9 100644 (file)
@@ -5,18 +5,8 @@ int magicVariable()
   if (__ctfe)
    return 3;
 
-  version(GNU)
-  {
-    version(X86)
-      asm { "nop"; }
-    else version(X86_64)
-      asm { "nop"; }
-    else
-      static assert("");
-  }
-  else
-      asm { nop; }
-  return 2;
+  shared int var = 2;
+  return var;
 }
 
 static assert(magicVariable()==3);
@@ -122,20 +112,14 @@ struct StructWithCtor
     float x;
 }
 
-int containsAsm() {
-       version(GNU)
-       {
-         version(X86)
-           asm { "nop"; }
-         else version(X86_64)
-           asm { "nop"; }
-         else
-           static assert("");
-       }
-       else
-          asm { nop; }
-       return 0;
-    }
+int containsAsm()
+{
+    version (D_InlineAsm_X86)
+        asm { nop; }
+    else version (D_InlineAsm_X86_64)
+        asm { nop; }
+    return 0;
+}
 
 enum A = StructWithCtor(1);
 enum B = StructWithCtor(7, 2.3);
diff --git a/gcc/testsuite/gdc.test/runnable/imports/argufile.d b/gcc/testsuite/gdc.test/runnable/imports/argufile.d
deleted file mode 100644 (file)
index 2a85547..0000000
+++ /dev/null
@@ -1,146 +0,0 @@
-// argufile.d ----------------------------------------------------
-
-public:
-
-import core.vararg;
-import std.stdio;
-import std.utf;
-
-dstring formatstring(TypeInfo[] arguments, va_list argptr)
-{
-
-       dstring message = null;
-
-       void putc(dchar c)
-       {
-               message ~= c;
-       }
-
-
-       doFormat(&putc, arguments, argptr);
-
-
-       return message;
-}
-
-string arguments(...) // turns a bunch of arguments into a formatted char[] string
-{
-       return std.utf.toUTF8(formatstring(_arguments, _argptr));
-}
-
-void useargs(...)
-{
-       string crashage = arguments("why is 8 scared of 7? because", 7,8,9);
-
-       //printf("%.*s\n", crashage);
-       writefln(crashage);
-}
-
-
-// dustmited version of the deprecated doFormat.
-// See the full file at:
-// https://github.com/dlang/undeaD/blob/master/src/undead/doformat.d
-void doFormat(void delegate(dchar) putc, TypeInfo[] arguments, va_list ap)
-{
-    import core.stdc.stdlib : alloca, malloc;
-    import std.format ;
-
-    size_t bufLength = 1024;
-    void* argBuffer = malloc(bufLength);
-    size_t bufUsed ;
-    foreach (ti; arguments)
-    {
-        auto pos = bufUsed;
-        // Align to next word boundary
-        bufUsed += ti.tsize + size_t.sizeof - 1;
-        bufUsed -= bufUsed& size_t.sizeof - 1;
-        // Copy argument into buffer
-        va_arg(ap, ti, argBuffer + pos);
-    }
-
-    auto argptr = argBuffer;
-    void* skipArg(TypeInfo ti)
-    {
-        auto p = argptr;
-        // Align to next word boundary
-        argptr += ti.tsize + size_t.sizeof - 1;
-        argptr -= cast(size_t)argptr & size_t.sizeof - 1;
-        return p;
-    }
-    auto getArg(T)()
-    {
-        return *cast(T*)skipArg(typeid(T));
-    }
-
-    TypeInfo ti;
-    Mangle m;
-    void formatArg()
-    {
-        ulong vnumber;
-        char vchar;
-        Mangle m2;
-        int signed ;
-        string s;
-
-        void putstr(const char[] s)
-        {
-            foreach (c; s)
-                putc(c);
-
-        }
-
-        //printf("formatArg(fc = '%c', m = '%c')\n", fc, m);
-        int mi;
-        switch (m)
-        {
-            L2:
-                putstr((&vchar)[0 .. 1]);
-                return;
-
-            case Mangle.Tint:
-                signed = 1;
-                vnumber = getArg!int;
-                goto Lnumber;
-
-            case Mangle.Tarray:
-                mi = 10;
-while (1)
-                {
-                    m2 = cast(Mangle)typeid(ti).name[mi];
-                    switch (m2)
-                    {
-                        case Mangle.Tchar:
-                            s = getArg!string;
-                            putstr(s);
-                            break;
-
-                        case Mangle.Timmutable:
-                            mi++;
-                            continue;
-
-                        default:
-                            {}
-                    }
-                    return;
-                }
-            default:
-                {}
-        }
-
-    Lnumber:
-;
-vchar = cast(char)('0' + vnumber);
-                goto L2;
-    }
-
-    for (int j ; j < arguments.length; )
-    {
-        ti = arguments[j++];
-        int mi = 9;
-        do
-            m = cast(Mangle)typeid(ti).name[mi++];
-while (m == Mangle.Tconst );
-
-            formatArg;
-    }
-}
index 3a7beaf187e865aba77193f7d8f23d17b7282506..ee17be0b00fe9c3b8575cb88cf6ea6043214e268 100644 (file)
@@ -357,36 +357,22 @@ void test16()
 
 void test17()
 {
+    version(D_InlineAsm_X86_64)
+        enum AsmX86 = true;
+    else version(D_InlineAsm_X86)
+        enum AsmX86 = true;
+    else
+        enum AsmX86 = false;
+
     version (OSX)
     {
     }
     else
     {
-        /*const*/ float f = 1.2f;
+        const f = 1.2f;
         float g = void;
 
-
-        version(D_SoftFloat)
-        {
-            g = f;
-        }
-        else version(GNU)
-        {
-            version(X86) asm
-            {
-                "flds %1; fstps %0;" : "=m" (g) : "m" (f) : ;
-            }
-            else version(X86_64) asm
-            {
-                "flds %1; fstps %0;" : "=m" (g) : "m" (f) : ;
-            }
-            else version(ARM) asm
-            {
-                "vldr d0, %1; vstr d0, %0;" : "=m" (g) : "m" (f), : "d0";
-            }
-            else static assert(false, "ASM code not implemented for this architecture");
-        }
-        else
+        static if (AsmX86)
         {
             asm
             {
@@ -394,6 +380,10 @@ void test17()
                 fstp g;
             }
         }
+        else
+        {
+            g = f;
+        }
         assert(g == 1.2f);
     }
 }
index 003024db97772ce46a0fa83c9c79690f7e51ddb4..5c28d0f8252424d5038d08d0e6acb632005f6fd0 100644 (file)
@@ -707,24 +707,7 @@ void foo35()
         c = 3;
 
         xxx = cast(typeof(xxx))(a + b);
-        version(GNU)
-        {
-            version(X86) asm
-            {
-                "int $3;" : : : ;
-            }
-            else version(X86_64) asm
-            {
-                "int $3;" : : : ;
-            }
-            else
-            {
-                import gcc.builtins;
-                __builtin_trap();
-            }
-        }
-        else
-            asm { int 3; }
+        throw new Exception("xxx");
         xxx( 4, 5, 6 );
 }
 
diff --git a/gcc/testsuite/gdc.test/runnable/test36.d b/gcc/testsuite/gdc.test/runnable/test36.d
deleted file mode 100644 (file)
index 9f5b140..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-// PERMUTE_ARGS:
-
-import std.stdio;
-interface IUnknown{
-        extern(Windows):
-        void func();
-}
-class ComObject :IUnknown
-{
-extern (Windows):
-        void func()
-        {writefln(`comobject`);
-        }
-}
-interface IDataObject: IUnknown
-{
-        extern(Windows):
-        void method();
-}
-package class invarianttest:ComObject, IDataObject
-{
-        invariant()
-        {
-                writefln(`hello invariant`);
-        }
-
-extern (Windows):
-        override void func()
-        {
-        int esp;
-        version(GNU)
-        {
-            version(X86) asm
-            {
-                "mov %%ESP,%0" : "=r" esp : : ;
-            }
-            else version(X86_64) asm
-            {
-                "mov %%ESP,%0" : "=r" esp : : ;
-            }
-            else version(ARM) asm
-            {
-                "str sp,%0" : "=m" esp : : ;
-            }
-            else static assert(false, "ASM code not implemented for this architecture");
-        }
-        else asm
-        {
-                mov esp,ESP;
-        }
-        printf("\n%d",esp);
-        printf(`func`);
-        }
-        void method()
-        {
-                writefln(`method`);
-        }
-}
-int main()
-{
-        auto inst= new invarianttest;
-        int esp;
-        version(GNU)
-        {
-            version(X86) asm
-            {
-                "mov %%ESP,%0" : "=r" esp : : ;
-            }
-            else version(X86_64) asm
-            {
-                "mov %%ESP,%0" : "=r" esp : : ;
-            }
-            else version(ARM) asm
-            {
-                "str sp,%0" : "=m" esp : : ;
-            }
-            else static assert(false, "ASM code not implemented for this architecture");
-        }
-        else asm
-        {
-                mov esp,ESP;
-        }
-        inst.func();
-        inst.method();
-        writefln("\n%d",esp);
-        version(GNU)
-        {
-            version(X86) asm
-            {
-                "mov %%ESP,%0" : "=r" esp : : ;
-            }
-            else version(X86_64) asm
-            {
-                "mov %%ESP,%0" : "=r" esp : : ;
-            }
-            else version(ARM) asm
-            {
-                "str sp,%0" : "=m" esp : : ;
-            }
-            else static assert(false, "ASM code not implemented for this architecture");
-        }
-        else asm
-        {
-                mov esp,ESP;
-        }
-        writefln("\n%d",esp);
-        return 0;
-}
-
index e75eb70da97b2a4a6c7c206133bbf71001b3c684..b9619c992ff15ea360409b99b0122723f6cb61d7 100644 (file)
@@ -2469,40 +2469,21 @@ bool foo150()
 void crash(int x)
 {
     if (x==200) return;
-
-    version(GNU)
-    {
-        version(X86) asm
-        {
-            "int $3;" : :  :;
-        }
-        else version(X86_64) asm
-        {
-            "int $3;" : : :;
-        }
-        else
-        {
-            import gcc.builtins;
-            __builtin_trap();
-        }
-    }
-    else
-    {
-        asm { int 3; }
-    }
+    assert(0);
 }
 
 void test151()
 {
-   int x;
-   bug3521(&x);
+    int x;
+    bug3521(&x);
 }
 
-void bug3521(int *a){
+void bug3521(int *a)
+{
     int c = 0;
     *a = 0;
     if ( *a || (*a != (c = 200)) )
-       crash(c);
+        crash(c);
 }
 
 /***************************************************/
@@ -4236,28 +4217,22 @@ void oddity4001()
 }
 
 /***************************************************/
+// https://issues.dlang.org/show_bug.cgi?id=3809
 
 int bug3809()
 {
-    version(GNU)
-    {
-        version(X86)
-            asm { "nop"; }
-        else version(X86_64)
-            asm { "nop"; }
-        else version(ARM)
-            asm { "nop"; }
-        else
-            static assert(false, "ASM code not implemented for this architecture");
-    }
-    else
-    {
-        asm { nop; }
-    }
-    return 0;
+    static int a = 0;
+    return a;
 }
-struct BUG3809 { int xx; }
-void bug3809b() {
+
+struct BUG3809
+{
+    int xx;
+}
+
+void bug3809b()
+{
+    BUG3809 b = { bug3809() };
 }
 
 /***************************************************/
index 543fef589ab3499ee3df4e50dca71914fa7e6e65..cec4c0f7fa435b21582cd2d2f7a9be6aff5b9614 100644 (file)
@@ -207,18 +207,9 @@ void safeexception()
 @safe
 void inlineasm()
 {
-    version(GNU)
-    {
-        version(X86)
-            static assert(!__traits(compiles, { asm { "nop"; } }() ));
-        else version(X86_64)
-            static assert(!__traits(compiles, { asm { "nop"; } }() ));
-        else version(ARM)
-            static assert(!__traits(compiles, { asm { "nop"; } }() ));
-        else
-            static assert(false, "ASM code not implemented for this architecture");
-    }
-    else
+    version (D_InlineAsm_X86)
+        static assert(!__traits(compiles, { asm { int 3; } }() ));
+    else version (D_InlineAsm_X86_64)
         static assert(!__traits(compiles, { asm { int 3; } }() ));
 }
 
index e64b7708520ef5575febb5453c75d08f0011f5f3..c749c4c055d6584d1e59de143ea9810a66ad9a2a 100644 (file)
@@ -192,6 +192,8 @@ proc gdc_init { args } {
     global GDC_UNDER_TEST
     global TESTING_IN_BUILD_TREE
     global TEST_ALWAYS_FLAGS
+    global gcc_warning_prefix
+    global gcc_error_prefix
 
     # We set LC_ALL and LANG to C so that we get the same error messages as expected.
     setenv LC_ALL C
@@ -250,6 +252,9 @@ proc gdc_init { args } {
 
     verbose -log "ALWAYS_DFLAGS set to $ALWAYS_DFLAGS"
 
+    set gcc_warning_prefix "warning:"
+    set gcc_error_prefix "(fatal )?error:"
+
     verbose "gdc is initialized" 3
 }