[d] Committed merge with upstream dmd

Message ID CABOHX+cuNdH1gf3mpaKGCpfCPO2PGZSQ5Ca7_VO5H-aNrxor+g@mail.gmail.com
State New
Headers show
Series
  • [d] Committed merge with upstream dmd
Related show

Commit Message

Iain Buclaw April 11, 2019, 9:15 p.m.
Hi,

This patch merges the D front-end implementation with dmd upstream d7ed327ed.

Backports fix for an ICE that occurred when accessing empty array in CTFE.

Bootstrapped and regression tested on x86_64-linux-gnu.

Committed to trunk as r270294.

-- 
Iain
---

Patch

diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index 31ea106965b..800be95e4e6 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@ 
-5dd3eccc3b0758346f77bee3cdc3f6bd15de339b
+d7ed327edb0b01ad56e7e73e77b3401cd565675e
 
 The first line of this file holds the git revision number of the last
 merge done from the dlang/dmd repository.
diff --git a/gcc/d/dmd/dinterpret.c b/gcc/d/dmd/dinterpret.c
index 777f89cf186..40f3e77cbc5 100644
--- a/gcc/d/dmd/dinterpret.c
+++ b/gcc/d/dmd/dinterpret.c
@@ -6272,11 +6272,14 @@  Expression *scrubReturnValue(Loc loc, Expression *e)
 /* Returns: true if e is void,
  * or is an array literal or struct literal of void elements.
  */
-static bool isVoid(Expression *e)
+static bool isVoid(Expression *e, bool checkArray = false)
 {
     if (e->op == TOKvoid)
         return true;
 
+    if (checkArray && e->type->ty != Tsarray)
+        return false;
+
     if (e->op == TOKarrayliteral)
         return isEntirelyVoid(((ArrayLiteralExp *)e)->elements);
 
@@ -6314,7 +6317,7 @@  Expression *scrubArray(Loc loc, Expressions *elems, bool structlit)
 
         // A struct .init may contain void members.
         // Static array members are a weird special case (bug 10994).
-        if (structlit && isVoid(e))
+        if (structlit && isVoid(e, true))
         {
             e = NULL;
         }
diff --git a/gcc/testsuite/gdc.test/compilable/test19778.d b/gcc/testsuite/gdc.test/compilable/test19778.d
new file mode 100644
index 00000000000..87905fae6a0
--- /dev/null
+++ b/gcc/testsuite/gdc.test/compilable/test19778.d
@@ -0,0 +1,6 @@ 
+struct S
+{
+    int[] data;
+}
+immutable X = S([]);
+enum len = X.data.length;