re PR d/90661 (ICE in AlignDeclaration::syntaxCopy, at d/dmd/attrib.c:670)
authorIain Buclaw <ibuclaw@gcc.gnu.org>
Sun, 16 Jun 2019 07:47:57 +0000 (07:47 +0000)
committerIain Buclaw <ibuclaw@gcc.gnu.org>
Sun, 16 Jun 2019 07:47:57 +0000 (07:47 +0000)
PR d/90661
d/dmd: Merge upstream dmd c74e624c9

Fixes segmentation fault in AlignDeclaration::syntaxCopy.

Reviewed-on: https://github.com/dlang/dmd/pull/10001

From-SVN: r272341

gcc/d/dmd/MERGE
gcc/d/dmd/attrib.c
gcc/testsuite/gdc.test/compilable/aggr_alignment.d
gcc/testsuite/gdc.test/fail_compilation/fail19914.d [new file with mode: 0644]
gcc/testsuite/gdc.test/fail_compilation/fail19915.d [new file with mode: 0644]

index e100264fed851328c69b44bc4b4c56b66c2399e6..6edc63a201420ea560ef1b335c905ae654d698b2 100644 (file)
@@ -1,4 +1,4 @@
-78dc311524341a76008b341ff6427e5a16e285db
+c74e624c9a0a9e7e39f96b2f005f86e123df56c9
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/dmd repository.
index a668638148592e5c1039cd84f021c6252578f61a..6cd715ce08b6768afd208b0d0d85ff389d84b1ad 100644 (file)
@@ -667,7 +667,8 @@ Dsymbol *AlignDeclaration::syntaxCopy(Dsymbol *s)
 {
     assert(!s);
     return new AlignDeclaration(loc,
-        ealign->syntaxCopy(), Dsymbol::arraySyntaxCopy(decl));
+        ealign ? ealign->syntaxCopy() : NULL,
+        Dsymbol::arraySyntaxCopy(decl));
 }
 
 Scope *AlignDeclaration::newScope(Scope *sc)
index 3a80a039e26edcbb3dcb34485466c6b2f3c6ae9e..bf602ff31a476a987b8c4d7cee6dabbe4bcebb97 100644 (file)
@@ -26,3 +26,16 @@ enum payloadOffset = C2.bytes.offsetof;
 static assert(C2.int1.offsetof == payloadOffset + 8);
 static assert(C2.alignof == size_t.sizeof);
 static assert(__traits(classInstanceSize, C2) == payloadOffset + 12);
+
+
+/***************************************************/
+// https://issues.dlang.org/show_bug.cgi?id=19914
+// https://issues.dlang.org/show_bug.cgi?id=19915
+
+class TemplatedClass(T)
+{
+    align T field;
+}
+
+mixin TemplatedClass!(string);
+alias TCint = TemplatedClass!(int);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19914.d b/gcc/testsuite/gdc.test/fail_compilation/fail19914.d
new file mode 100644 (file)
index 0000000..a890d35
--- /dev/null
@@ -0,0 +1,10 @@
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail19914.d(9): Error: undefined identifier `c` in module `fail19914`
+fail_compilation/fail19914.d(10): Error: mixin `fail19914.a!string` error instantiating
+---
+*/
+class a(b) { align.c d; }
+mixin a!(string);
diff --git a/gcc/testsuite/gdc.test/fail_compilation/fail19915.d b/gcc/testsuite/gdc.test/fail_compilation/fail19915.d
new file mode 100644 (file)
index 0000000..17e05ee
--- /dev/null
@@ -0,0 +1,10 @@
+// PERMUTE_ARGS:
+/*
+TEST_OUTPUT:
+---
+fail_compilation/fail19915.d(9): Error: undefined identifier `c` in module `fail19915`
+fail_compilation/fail19915.d(10): Error: template instance `fail19915.a!int` error instantiating
+---
+*/
+class a (b) { align.c d; }
+alias a!(int) e;