d: Fix ICE in create_tmp_var, at gimple-expr.c:482
authorIain Buclaw <ibuclaw@gdcproject.org>
Fri, 4 Sep 2020 20:54:22 +0000 (22:54 +0200)
committerIain Buclaw <ibuclaw@gdcproject.org>
Fri, 4 Sep 2020 21:01:46 +0000 (23:01 +0200)
Array concatenate expressions were creating more SAVE_EXPRs than what
was necessary.  The internal error itself was the result of a forced
temporary being made on a TREE_ADDRESSABLE type.

gcc/d/ChangeLog:

PR d/96924
* expr.cc (ExprVisitor::visit (CatAssignExp *)): Don't force
temporaries needlessly.

gcc/testsuite/ChangeLog:

PR d/96924
* gdc.dg/simd13927b.d: Removed.
* gdc.dg/pr96924.d: New test.

gcc/d/expr.cc
gcc/testsuite/gdc.dg/pr96924.d [new file with mode: 0644]
gcc/testsuite/gdc.dg/simd13927b.d [deleted file]

index 2b13615521dd0398548dac08786a27170578c60d..79f212c3a08f274b043e5e3c4531962b6f2ed3fe 100644 (file)
@@ -875,7 +875,6 @@ public:
            tree offexp = d_array_length (result);
            offexp = build2 (MINUS_EXPR, TREE_TYPE (offexp),
                             offexp, size_one_node);
-           offexp = d_save_expr (offexp);
 
            tree ptrexp = d_array_ptr (result);
            ptrexp = void_okay_p (ptrexp);
@@ -885,9 +884,7 @@ public:
            tree t2 = build_expr (e->e2);
            tree expr = stabilize_expr (&t2);
 
-           t2 = d_save_expr (t2);
            result = modify_expr (build_deref (ptrexp), t2);
-           result = compound_expr (t2, result);
 
            this->result_ = compound_expr (expr, result);
          }
diff --git a/gcc/testsuite/gdc.dg/pr96924.d b/gcc/testsuite/gdc.dg/pr96924.d
new file mode 100644 (file)
index 0000000..25d9a56
--- /dev/null
@@ -0,0 +1,14 @@
+// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96924
+// { dg-do compile }
+
+struct Memo
+{
+    string source;
+    this(this);
+}
+
+void compile(string src, size_t end)
+{
+    Memo[] stack;
+    stack  ~= Memo(src[end .. $]);
+}
diff --git a/gcc/testsuite/gdc.dg/simd13927b.d b/gcc/testsuite/gdc.dg/simd13927b.d
deleted file mode 100644 (file)
index fbbaf86..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// https://issues.dlang.org/show_bug.cgi?id=13927
-// { dg-additional-options "-mavx" { target avx_runtime } }
-// { dg-do compile { target { avx_runtime || vect_sizes_16B_8B } } }
-import core.simd;
-
-alias double8 = __vector(double[8]);
-
-void test13927(double8 a)
-{
-    double8 b = [long.min, long.min, long.max, long.max];
-    auto tmp = a - b;
-}