Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@
/// br loop_entry(v0)
/// loop_entry(i: Field):
/// v2 = lt i v1
/// brif v2, then: loop_body, else: loop_end

Check warning on line 522 in compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (brif)
/// loop_body():
/// v3 = ... codegen body ...
/// v4 = add 1, i
Expand Down Expand Up @@ -664,7 +664,7 @@
///
/// ```text
/// v0 = ... codegen cond ...
/// brif v0, then: then_block, else: else_block

Check warning on line 667 in compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (brif)
/// then_block():
/// v1 = ... codegen a ...
/// br end_if(v1)
Expand All @@ -679,7 +679,7 @@
///
/// ```text
/// v0 = ... codegen cond ...
/// brif v0, then: then_block, else: end_if

Check warning on line 682 in compiler/noirc_evaluator/src/ssa/ssa_gen/mod.rs

View workflow job for this annotation

GitHub Actions / Code

Unknown word (brif)
/// then_block:
/// v1 = ... codegen a ...
/// br end_if()
Expand Down Expand Up @@ -1083,8 +1083,8 @@
}

fn codegen_assign(&mut self, assign: &ast::Assign) -> Result<Values, RuntimeError> {
let lhs = self.extract_current_value(&assign.lvalue)?;
let rhs = self.codegen_expression(&assign.expression)?;
let lhs = self.extract_current_value(&assign.lvalue)?;

self.assign_new_value(lhs, rhs);
Ok(Self::unit_value())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[package]
name = "assign_evaluation_order"
type = "bin"
authors = [""]

[dependencies]
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
fn main() {
let result1 = bug_8262((1, true, false));
assert_eq(result1, 2);

let result2 = bug_8337();
assert_eq(result2, [10, 40, 10]);
}

fn bug_8262(mut a: (i32, bool, bool)) -> i32 {
a.1 = if a.1 {
a = (2, a.2, a.1);
true
} else {
!a.2
};
a.0
}

fn bug_8337() -> [Field; 3] {
let mut a = [10, 20, 30];
a[1] = {
a = {
a[2] = a[0];
[a[0], 40, a[2]]
};
a[1]
};
a
}
Loading