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

[T]::pop_front() errors during execution inside a dynamic non-executed if #6285

Open
michaeljklein opened this issue Oct 11, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@michaeljklein
Copy link
Contributor

michaeljklein commented Oct 11, 2024

Aim

Similar to 5462, but the if's predicate isn't known at compile time.

Attempted to nargo execute the following program:

fn main(x: bool) {
    println("x's value:");
    println(x);
    println("");

    if x {
        let empty_slice: [u8] = &[];
        let _ = empty_slice.pop_front();
    }
}

NOTE: re-enable the array_regex tests once this is resolved

Expected Behavior

Expected the program to print the following and execute successfully:

x's value:
false

Bug

Program fails at execution time with the following error:

x's value:
false

error: Index out of bounds, array has size 0, but index was 0
  ┌─ /Users/michaelklein/Coding/rust/noir/test_programs/execution_success/regression_test_5462/src/main.nr:8:17

8 │         let _ = empty_slice.pop_front();
  │                 ---------------------

  = Call stack:
    1. /Users/michaelklein/Coding/rust/noir/test_programs/execution_success/regression_test_5462/src/main.nr:8:17

Failed to solve program: 'Index out of bounds, array has size 0, but index was 0'

To Reproduce

Workaround

None

Workaround Description

No response

Additional Context

No response

Project Impact

None

Blocker Context

No response

Nargo Version

No response

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

@michaeljklein michaeljklein added the bug Something isn't working label Oct 11, 2024
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