Kill dag leaf nodes on assignment.

Fixes the failing swap test caused by a's original value being used (via t)
after being written.
This commit is contained in:
Bill Currie 2018-08-23 20:07:22 +09:00
parent cb366dd825
commit 2fcda44ab0

View file

@ -475,6 +475,11 @@ dagnode_attach_label (dagnode_t *n, daglabel_t *l)
internal_error (0, "attempt to attach non-identifer label to dagnode " internal_error (0, "attempt to attach non-identifer label to dagnode "
"identifiers"); "identifiers");
if (l->dagnode) { if (l->dagnode) {
// if the node is a leaf, then kill its value so no attempt is made
// to reuse it.
if (l->dagnode->type == st_none) {
l->dagnode->killed = 1;
}
dagnode_t *node = l->dagnode; dagnode_t *node = l->dagnode;
set_union (n->edges, node->parents); set_union (n->edges, node->parents);
set_remove (n->edges, n->number); set_remove (n->edges, n->number);