You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider the following program (lines indexed from 1):
fn main() {
for i in 0..2 {
println("---Test");
}
}
Running nargo debug on this program, and stepping through it with next yields the following behavior:
cursor is pointing to line 1;
cursor is pointing to line 2, and highlighting i;
cursor is pointing to line 3, and highlighting the whole println expression;
cursor jumps back to line 2, highlighting 2, which is the boundary check of the loop;
cursor is pointing to line 2, and highlighting i;
cursor is pointing to line 3, and highlighting the whole println expression;
cursor is pointing to line 3, and highlighting the whole println expression;
cursor jumps back to line 4, highlighting nothing, which is the closing bracket of the loop body;
cursor jumps back to line 2, highlighting 2, which is the boundary check of the loop;
cursor is pointing to line 2, and highlighting i;
cursor is pointing to line 3, and highlighting the whole println expression;
cursor is pointing to line 3, and highlighting the whole println expression;
cursor jumps back to line 4, highlighting nothing, which is the closing bracket of the loop body;
cursor jumps back to line 2, highlighting 2, which is the boundary check of the loop;
cursor jumps back to line 5, highlighting nothing, which is the closing bracket of the function body; and
finished execution.
Expected Behavior
cursor is pointing to line 1; cursor is pointing to line 2, and highlighting i; cursor is pointing to line 3, and highlighting the whole println expression;
cursor is pointing to line 2, highlighting 2, which is the boundary check of the loop;
cursor is pointing to line 2, and highlighting i;
cursor is pointing to line 3, and highlighting the whole println expression;
cursor is pointing to line 3, and highlighting the whole println expression;
cursor jumps back to line 4, highlighting nothing, which is the closing bracket of the loop body;
cursor jumps back to line 2, highlighting 2, which is the boundary check of the loop;
cursor is pointing to line 2, and highlighting i;
cursor is pointing to line 3, and highlighting the whole println expression;
cursor is pointing to line 3, and highlighting the whole println expression;
cursor jumps back to line 4, highlighting nothing, which is the closing bracket of the loop body;
cursor jumps back to line 2, highlighting 2, which is the boundary check of the loop;
cursor jumps back to line 5, highlighting nothing, which is the closing bracket of the function body; and
finished execution.
Bug
In the observed behavior, the loop seems to be entered before the first boundary check is made.
To Reproduce
nargo new bug_example && cd bug_example
copy the source mentioned earlier in src/main.nr
run nargo debug and step through the program using next
Workaround
Yes
Workaround Description
Commenting out Ssa::loop_invariant_code_motion and Ssa::fold_constants from the list of performed optimizations and recompiling nargo leads to the expected behavior of nargo debug.
P.S., disabling just Ssa::loop_invariant_code_motion leads to a different behavior of nargo debug, but it is still not the naturally expected one. Let me know and we can file a separate issue.
Additional Context
No response
Project Impact
Blocker
Blocker Context
Our project (a debugger GUI) depends on the natural behavior of nargo debug.
Nargo Version
nargo version = 1.0.0-beta.2 noirc version = 1.0.0-beta.2+b7ace682af1ab8a43308457302f08b151af342db (git version hash: b7ace68, 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
The text was updated successfully, but these errors were encountered:
Aim
Consider the following program (lines indexed from 1):
Running
nargo debug
on this program, and stepping through it withnext
yields the following behavior:i
;println
expression;2
, which is the boundary check of the loop;i
;println
expression;println
expression;2
, which is the boundary check of the loop;i
;println
expression;println
expression;2
, which is the boundary check of the loop;Expected Behavior
cursor is pointing to line 2, and highlightingi
;cursor is pointing to line 3, and highlighting the wholeprintln
expression;2
, which is the boundary check of the loop;i
;println
expression;println
expression;2
, which is the boundary check of the loop;i
;println
expression;println
expression;2
, which is the boundary check of the loop;Bug
In the observed behavior, the loop seems to be entered before the first boundary check is made.
To Reproduce
nargo new bug_example && cd bug_example
src/main.nr
nargo debug
and step through the program usingnext
Workaround
Yes
Workaround Description
Commenting out
Ssa::loop_invariant_code_motion
andSsa::fold_constants
from the list of performed optimizations and recompilingnargo
leads to the expected behavior ofnargo debug
.P.S., disabling just
Ssa::loop_invariant_code_motion
leads to a different behavior ofnargo debug
, but it is still not the naturally expected one. Let me know and we can file a separate issue.Additional Context
No response
Project Impact
Blocker
Blocker Context
Our project (a debugger GUI) depends on the natural behavior of
nargo debug
.Nargo Version
nargo version = 1.0.0-beta.2 noirc version = 1.0.0-beta.2+b7ace682af1ab8a43308457302f08b151af342db (git version hash: b7ace68, 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
The text was updated successfully, but these errors were encountered: