detect cyclic bindings in attr_vars_of_term (#1666)

This commit is contained in:
Mark Thom
2022-12-15 23:26:36 -07:00
parent b4b72a3166
commit 0a8fc70ba9
3 changed files with 88 additions and 79 deletions

View File

@@ -147,6 +147,16 @@ impl MachineState {
let value = unmark_cell_bits!(value);
if h != iter.focus() {
let deref_value = heap_bound_store(iter.heap, heap_bound_deref(iter.heap, value));
if deref_value.is_compound(iter.heap) {
// a cyclic structure is bound to the attributed variable at h.
// it mustn't be included in seen_vars.
continue;
}
}
seen_vars.push(value);
seen_set.insert(h);