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)
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);
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);
}
--- /dev/null
+// 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 .. $]);
+}