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

Runtime juvix assertion error in Hanoi example #1919

Closed
paulcadman opened this issue Mar 23, 2023 · 1 comment · Fixed by #1924
Closed

Runtime juvix assertion error in Hanoi example #1919

paulcadman opened this issue Mar 23, 2023 · 1 comment · Fixed by #1924

Comments

@paulcadman
Copy link
Collaborator

paulcadman commented Mar 23, 2023

I compiled the Hanoi example with the --debug flag for the native target on macOS aarch64:

https://github.com/anoma/juvix/blob/dbe9ff61d794637a3315068c65bfd296512f07dc/examples/milestone/Hanoi/Hanoi.juvix

juvix compile -g Hanoi.juvix

When running the program you get the following error:

./Hanoi
examples/milestone/Hanoi/.juvix-build/Hanoi.c:216: Juvix assertion failed. Please report.

NB: The program runs without error and with the expected output when I use the wasm32-wasi target, or when I use the native target without the --debug flag .

After doing some debugging the trace looks like this:

JUVIX_STR_CONCAT -

#define JUVIX_STR_CONCAT(var0, var1, var2) CONCAT_CSTRINGS(var0, var1, var2)

CONCAT_CSTRINGS -
ALLOC(tmp, juvix_nfields + 1); \

ALLOC -
#define ALLOC(ptr, n) \

and the failing assertion is caused by an is_same_page check:

ASSERT(is_same_page(juvix_memory_pointer, juvix_memory_pointer + n)); \

@lukaszcz
Copy link
Collaborator

Probably forgot to include the memory allocated for string concatenation in the memory usage count. I'll look into it.

@lukaszcz lukaszcz self-assigned this Mar 23, 2023
@lukaszcz lukaszcz added this to the 0.3.1 milestone Mar 23, 2023
paulcadman pushed a commit that referenced this issue Mar 23, 2023
paulcadman added a commit that referenced this issue Mar 24, 2023
In this PR I will add tests for the example programs in
`examples/milestone`.

There's currently an runtime assertion error generated by the Hanoi
example #1919, so it'd be good to
test these programs in the future.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants