-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[Prover] Fix bug in loop unrolling #15136
Conversation
⏱️ 1h 52m total CI duration on this PR
🚨 1 job on the last run was significantly faster/slower than expected
|
@@ -102,7 +102,7 @@ error: abort not covered by any of the `aborts_if` clauses | |||
┌─ tests/sources/functional/aborts_if.move:139:5 | |||
│ | |||
137 │ if (x == 2 || x == 3) abort 1; | |||
│ ------ abort happened here with code 0x1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is due to cfg simplification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an issue to track the expression attribution being so wrong in V2 here? V1 shows the abort at the abort expression.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will file one once it is landed
= at tests/sources/functional/bv_aborts.move:16: assert_with_spec (spec) | ||
|
||
error: abort not covered by any of the `aborts_if` clauses | ||
┌─ tests/sources/functional/bv_aborts.move:14:5 | ||
│ | ||
12 │ assert!(x > 815); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is due to cfg simplification
This stack of pull requests is managed by Graphite. Learn more about stacking. Join @rahxephon89 and the rest of your teammates on Graphite |
@@ -20,11 +20,11 @@ fun m::if_1($t0|c: bool): u8 { | |||
1: $t1 := $t2 | |||
2: $t3 := move($t0) | |||
3: if ($t3) goto 4 else goto 8 | |||
4: label L1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change of exp files in this crate is due to cfg simplification.
@@ -15,24 +15,23 @@ module 0x1::fixed_point32 { | |||
*&(&self).value >> 32u8 | |||
} | |||
public fun create_from_rational(numerator: u64, denominator: u64): FixedPoint32 { | |||
let _t5; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change of exp files in this crate is due to cfg simplification.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR looks ok. Existing tests and error outputs look like they could be improved.
@@ -102,7 +102,7 @@ error: abort not covered by any of the `aborts_if` clauses | |||
┌─ tests/sources/functional/aborts_if.move:139:5 | |||
│ | |||
137 │ if (x == 2 || x == 3) abort 1; | |||
│ ------ abort happened here with code 0x1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an issue to track the expression attribution being so wrong in V2 here? V1 shows the abort at the abort expression.
│ ╰─────' abort happened here | ||
14 │ ╭ spec assert_with_spec { | ||
15 │ │ // This will fail | ||
16 │ │ aborts_if x > 815 with std::error::internal(0) | (0xCA26CBD9BE << 24); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we have a test that includes a spec which passes? This is an oddly specific spec to be the only test of its kind.
1dfc271
to
98b0aeb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -18,58 +18,50 @@ public fun m::f($t0|length: u64): u64 { | |||
var $t5: bool | |||
var $t6: u64 | |||
var $t7: u64 | |||
var $t8: u64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change of exp files in this crate is due to cfg simplification.
.collect(); | ||
let mut results = vec![]; | ||
for (i, (block_id, block)) in blocks.iter().enumerate() { | ||
// if this block has one successor and the last bc of this block is not a branch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"If this is a fall-through block (block has one successor...)" we need to remove it by ...
The fatloop algorithm doesn't support fallthrough.
98b0aeb
to
b7acb47
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
✅ Forge suite
|
Description
Currently, loop analysis collects bytecode for unrolling loops and returns a vector of basic blocks, which will be directly flatten later. This implementation will lead to incorrect boogie code if a block in the vector falls through to its successor in the original CFG but the next element in the vector is actually not its successor. The bug leads to verification failure shown in #15044 when CFG simplification is turned on. This PR fixes the issue by inserting the explicit jump instruction.
Close #15044
How Has This Been Tested?
Key Areas to Review
The code change will only influence bounded verification with
unroll
pragma. Need to make sure this change will not affect other part of the prover.Type of Change
Which Components or Systems Does This Change Impact?
Checklist