jasmin-lang/jasmin

Swapping arrays

Closed this issue · 0 comments

vbgl commented

The following program leads to an internal compilation error: “stack allocation: variable a should be a reg ptr”.

export
fn swapa(reg u64 x) -> reg u64 {
  stack u64[1] a b;
  a[0] = x;
  b[0] = x;
  a, b = #swap(a, b);
  x = a[0];
  return x;
}

I see two possible fixes: either reject this program early (e.g., during pre-typing) or strengthen make-reference-arguments to also take care of pseudo-operators.