-
Notifications
You must be signed in to change notification settings - Fork 244
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
19 additions
and
17 deletions.
There are no files selected for viewing
19 changes: 10 additions & 9 deletions
19
test_programs/execution_failure/regression_7128/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 |
---|---|---|
@@ -1,26 +1,27 @@ | ||
fn main(in0: Field) -> pub Field { | ||
let mut out0 : Field = 0; | ||
let mut tmp1 : Field = 0; | ||
let mut out0: Field = 0; | ||
let mut tmp1: Field = 0; | ||
|
||
if ((out0 == out0) & true) // <== changing out0 to in0 or removing | ||
{ // the comparison changes the result | ||
let in0_as_bytes : [u8; 32] = in0.to_be_bytes(); | ||
let mut result : [u8; 32] = 0.to_be_bytes(); | ||
{ | ||
// the comparison changes the result | ||
let in0_as_bytes: [u8; 32] = in0.to_be_bytes(); | ||
let mut result: [u8; 32] = 0.to_be_bytes(); | ||
for i in 0..32 { | ||
result[i] = (in0_as_bytes[i] ^ result[i]); | ||
} | ||
tmp1 = std::field::bytes32_to_field(result); | ||
} | ||
|
||
let mut tmp2 : Field = 0; // <== moving this to the top of main, | ||
if (0.lt(in0)) // changes the result | ||
let mut tmp2: Field = 0; // <== moving this to the top of main, | ||
if (0.lt(in0)) // changes the result | ||
{ | ||
tmp2 = 1; | ||
} | ||
|
||
out0 = (tmp2 - tmp1); | ||
|
||
assert(out0 != 0, "soundness violation"); | ||
assert(out0 != 0, "soundness violation"); | ||
|
||
out0 | ||
} | ||
} |
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