forked from noir-lang/noir
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Discard optimisation that would change execution ordering or tha…
…t is related to call outputs (noir-lang#6461) Co-authored-by: Tom French <[email protected]>
- Loading branch information
1 parent
9ef8369
commit b8654f7
Showing
4 changed files
with
205 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[package] | ||
name = "regression_6451" | ||
type = "bin" | ||
authors = [""] | ||
[dependencies] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
x = 0 |
23 changes: 23 additions & 0 deletions
23
test_programs/execution_success/regression_6451/src/main.nr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
fn main(x: Field) { | ||
// Regression test for #6451 | ||
let y = unsafe { empty(x) }; | ||
let mut value = 0; | ||
let term1 = x * x - x * y; | ||
std::as_witness(term1); | ||
value += term1; | ||
let term2 = x * x - y * x; | ||
value += term2; | ||
value.assert_max_bit_size::<1>(); | ||
|
||
// Regression test for Aztec Packages issue #6451 | ||
let y = unsafe { empty(x + 1) }; | ||
let z = y + x + 1; | ||
let z1 = z + y; | ||
assert(z + z1 != 3); | ||
let w = y + 2 * x + 3; | ||
assert(w + z1 != z); | ||
} | ||
|
||
unconstrained fn empty(_: Field) -> Field { | ||
0 | ||
} |