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

Bug in HVM compiler: affinity is not checked #8

Open
adamritter opened this issue Dec 14, 2024 · 0 comments
Open

Bug in HVM compiler: affinity is not checked #8

adamritter opened this issue Dec 14, 2024 · 0 comments

Comments

@adamritter
Copy link

This program compiles to an invalid interaction net and works:

@double(a) =  (+ a a)
@main = @double(3)

The compiled output creates 2 references to the passed variable:


Term double_t(Term ref) {
  Loc opx0 = alloc_node(2);
  set(opx0 + 0, got(term_loc(ref) + 0));
  set(opx0 + 1, got(term_loc(ref) + 0));
  return term_new(OPX, 0, opx0);
}

In the current case main is 6, so it seems like the program is working, but more complex programs have serious issues as the compiled code gets incorrect.

The compiler SHOULD check if a variable is used twice and compilation SHOULD fail.

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

No branches or pull requests

1 participant