We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Execute this program:
unconstrained fn main() { let a: u1 = 1 >> 1; assert(a == 0); }
The execution completes successfully.
We get a runtime error:
error: Failed to solve brillig function, reason: Division by zero ┌─ /home/ggiraldez/Scratchpad/noir/bit_shifts_comptime/src/main.nr:2:22 │ 2 │ let a: u1 = 1 >> 1; │ - │ = Call stack: 1. /home/ggiraldez/Scratchpad/noir/bit_shifts_comptime/src/main.nr:2:22 Failed to solve brillig function, reason: Division by zero
Attempt to execute the given program.
Binary
nargo version = 0.22.0 noirc version = 0.22.0+3fae4a03fded4e3f5065e7461c563f7e39745604 (git version hash: 3fae4a0, is dirty: false)
Removing the unconstrained keyword makes the program execute correctly, even when the input is not a constant to avoid optimizing away the operations.
unconstrained
The same error reproduces when changing the bit size of the variable along with the shifting amount, ie.: let a: u8 = 1 >> 8;
let a: u8 = 1 >> 8;
This was found while testing the debugger (which outputs Brillig by default) with the execution success case bit_shifts_comptime.
bit_shifts_comptime
No
No response
The text was updated successfully, but these errors were encountered:
Fixed in #4301
Sorry, something went wrong.
No branches or pull requests
Aim
Execute this program:
Expected Behavior
The execution completes successfully.
Bug
We get a runtime error:
To Reproduce
Attempt to execute the given program.
Installation Method
Binary
Nargo Version
nargo version = 0.22.0 noirc version = 0.22.0+3fae4a03fded4e3f5065e7461c563f7e39745604 (git version hash: 3fae4a0, is dirty: false)
Additional Context
Removing the
unconstrained
keyword makes the program execute correctly, even when the input is not a constant to avoid optimizing away the operations.The same error reproduces when changing the bit size of the variable along with the shifting amount, ie.:
let a: u8 = 1 >> 8;
This was found while testing the debugger (which outputs Brillig by default) with the execution success case
bit_shifts_comptime
.Would you like to submit a PR for this Issue?
No
Support Needs
No response
The text was updated successfully, but these errors were encountered: