-
Notifications
You must be signed in to change notification settings - Fork 18
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
fix: llvm/stack/array_allocation_variable_index.ll #53
Conversation
`store_value` takes index first, value after, but the main function was passing `cell_1, cell_2` which is `value, index`. Swap the arguments.
Hey @Oppen, does it not affect the test result? |
Not on vm2. On lambdaclass/era_vm it was failing without this fix due to an out of bounds, as it checks absolute stores and read don't try to access values above the current SP and the swapped argument led to a rather big number (which I'm not sure if we should, so maybe our VM also has a bug there). |
Sorry, not vm2, but the default one. I'm not sure which one it is, but I ran the tester without feature flags. |
Interesting. It has never failed in our CI. |
We haven't tried nor integrated |
To verify this, could you kindly create a PR to https://github.com/matter-labs/era-compiler-tester with this submodule? |
I know, we're working on that in a branch. We're using a modified I'll go ahead and make the PR to the tester. |
@Oppen thanks, understood. Running now. |
BTW, I meant to ask about it. While I think this test was buggy, I'm not positive that our VM isn't bugged as well for not supporting the other order of arguments. |
@Oppen have you guys followed this spec in implementation? |
I can't tell for sure which document took precedence (I joined that project when it was relatively advanced), this spec or the Primer doc, but we do use it to disambiguate at least. Same for vm2, we may look at that code when in doubt. |
In particular, this is the bit for which my interpretation leads to adding the check:
I interpret that as SP marking the accessible parts of the stack, because of the "the topmost element" bit not making sense to me if accessing stuff after it is legal. |
Hey @sayon - could you take a look? |
@Oppen @hedgar2017 vm2 is the best spec that we currently have. All writing on the VM is outdated or plain wrong. vm2 is equivalent to zk_evm in the most minute details. And no, the stack pointer doesn't limit what is accessible. There are addressing modes that can be used to write to any part of the stack directly. |
Noted. I'll fix our VM then. Could the test still be reviewed? I still think the intent in the name and later load points to the arguments being swapped. It would be a good idea to add a test that intentionally tests any address in the stack is writable, too. |
Sure, we'll merge it! |
store_value
takes index first, value after, but the main function was passingcell_1, cell_2
which isvalue, index
.Swap the arguments.