]> gcc.gnu.org Git - gcc.git/commitdiff
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 20:59:53 +0000 (22:59 +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/pr96924.d: New test.

(cherry picked from commit 52908b8de15a1c762a73063f1162bcedfcc993b4)

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

index d1e71f987f7e997f476df875d0bc55f36a54e3ea..9191d3a9510c8b25f8c0f248a70ada39307ffff2 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 .. $]);
+}
This page took 0.087927 seconds and 5 git commands to generate.