Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swapping arrays #815

Closed
vbgl opened this issue May 29, 2024 · 0 comments · Fixed by #818
Closed

Swapping arrays #815

vbgl opened this issue May 29, 2024 · 0 comments · Fixed by #818

Comments

@vbgl
Copy link
Member

vbgl commented May 29, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant