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

Operator >> does arithmetic or logical shift, depending on rhs #6201

Open
Syndamia opened this issue Oct 2, 2024 · 0 comments
Open

Operator >> does arithmetic or logical shift, depending on rhs #6201

Syndamia opened this issue Oct 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@Syndamia
Copy link

Syndamia commented Oct 2, 2024

Aim

Attempted to create a simple program which right-shifts a number.

The following main.nr:

fn main(a: i16) {
    println(a >> 3);
}

with Prover.toml:

a = "-769"

Results with an arithmetic >>, outputing -96.

However, the following main.nr:

fn main(a: i16, b: u8) {
    println(a >> b);
}

with Prover.toml:

a = "-769"
b = 3

Results with a logical >>, outputting 8095.

Expected Behavior

>> to act consistently on the same value

Bug

>> with a constant right hand-side behaves as an arithmetic shift, while with an input value rhs it behaves as a logical shift

To Reproduce

  1. Create two Noir projects, for each pair of program and Prover.toml
  2. Run them with nargo execute
  3. Observe the different output

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

Nice-to-have

Blocker Context

No response

Nargo Version

nargo version = 0.34.0 noirc version = 0.34.0+94ed0b8fb13a923a59f6f3ccd8d7c75e191deeca (git version hash: 94ed0b8, is dirty: false)

NoirJS Version

No response

Proving Backend Tooling & Version

No response

Would you like to submit a PR for this Issue?

None

Support Needs

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant