-
Notifications
You must be signed in to change notification settings - Fork 5
fix(types): make #pointeeProjection confluent with source-first unwrapping strategy #988
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
Merged
automergerpr-permission-manager
merged 9 commits into
master
from
jh/close-account-multisig-write-volatile-array
Mar 27, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f8b6de0
test(prove-rs): add ptr-cast-wrapper-to-array-fail reproducer
Stevengre d455d67
fix(types): add priority(45) to struct rules in #pointeeProjection
Stevengre aeefea2
fix(types): make #pointeeProjection confluent with source-first strategy
Stevengre 0877ae1
test: remove ptr-cast-wrapper-to-array from PROVE_SHOW_SPECS
Stevengre 0c9184d
test(prove-rs): add ptr-cast-array-to-wrapper-fail (pre-existing bug)
Stevengre c22c881
fix(types): handle array-to-wrapper cast in #pointeeProjection
Stevengre 3a61a33
Merge branch 'master' into jh/close-account-multisig-write-volatile-a…
dkcumming 898c0e8
test(prove-rs): add reproducers for nested/singleton-array pointer ca…
Stevengre 51f158e
Merge branch 'master' into jh/close-account-multisig-write-volatile-a…
dkcumming File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
12 changes: 12 additions & 0 deletions
12
kmir/src/tests/integration/data/prove-rs/ptr-cast-array-to-nested-wrapper-fail.rs
This file contains hidden or 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,12 @@ | ||
| // [T; N] -> W2(W1([T; N])) - nested struct wrapping on target | ||
| #[derive(Clone, Copy, PartialEq, Debug)] | ||
| struct Inner([u8; 2]); | ||
|
|
||
| #[derive(Clone, Copy, PartialEq, Debug)] | ||
| struct Outer(Inner); | ||
|
|
||
| fn main() { | ||
| let arr: [u8; 2] = [11, 22]; | ||
| let o: Outer = unsafe { *((&arr) as *const [u8; 2] as *const Outer) }; | ||
| assert_eq!(o.0 .0, [11, 22]); | ||
| } |
9 changes: 9 additions & 0 deletions
9
kmir/src/tests/integration/data/prove-rs/ptr-cast-array-to-singleton-wrapped-array-fail.rs
This file contains hidden or 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,9 @@ | ||
| // [T; N] -> W([[T; N]; 1]) - singleton-array wrapping array (in-wrapper) on target | ||
| #[derive(Clone, Copy, PartialEq, Debug)] | ||
| struct Wrapper([[u8; 2]; 1]); | ||
|
|
||
| fn main() { | ||
| let arr: [u8; 2] = [11, 22]; | ||
| let w: Wrapper = unsafe { *((&arr) as *const [u8; 2] as *const Wrapper) }; | ||
| assert_eq!(w.0, [[11, 22]]); | ||
| } |
8 changes: 8 additions & 0 deletions
8
kmir/src/tests/integration/data/prove-rs/ptr-cast-array-to-wrapper-fail.rs
This file contains hidden or 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,8 @@ | ||
| #[derive(Clone, Copy, PartialEq, Debug)] | ||
| struct Wrapper([u8; 2]); | ||
|
|
||
| fn main() { | ||
| let arr: [u8; 2] = [11, 22]; | ||
| let w: Wrapper = unsafe { *((&arr) as *const [u8; 2] as *const Wrapper) }; | ||
| assert_eq!(w.0, [11, 22]); | ||
| } |
9 changes: 9 additions & 0 deletions
9
kmir/src/tests/integration/data/prove-rs/ptr-cast-nested-wrapper-to-array.rs
This file contains hidden or 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,9 @@ | ||
| // W2(W1([T; N])) -> [T; N] - nested struct wrapping on source | ||
| struct Inner([u8; 2]); | ||
| struct Outer(Inner); | ||
|
|
||
| fn main() { | ||
| let o = Outer(Inner([11, 22])); | ||
| let arr: [u8; 2] = unsafe { *((&o) as *const Outer as *const [u8; 2]) }; | ||
| assert_eq!(arr, [11, 22]); | ||
| } |
8 changes: 8 additions & 0 deletions
8
kmir/src/tests/integration/data/prove-rs/ptr-cast-singleton-wrapped-array-to-array.rs
This file contains hidden or 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,8 @@ | ||
| // W([[T; N]; 1]) -> [T; N] - singleton-array wrapping array (in-wrapper) on source | ||
| struct Wrapper([[u8; 2]; 1]); | ||
|
|
||
| fn main() { | ||
| let w = Wrapper([[11, 22]]); | ||
| let arr: [u8; 2] = unsafe { *((&w) as *const Wrapper as *const [u8; 2]) }; | ||
| assert_eq!(arr, [11, 22]); | ||
| } |
7 changes: 7 additions & 0 deletions
7
kmir/src/tests/integration/data/prove-rs/ptr-cast-wrapper-to-array.rs
This file contains hidden or 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,7 @@ | ||
| struct Wrapper([u8; 2]); | ||
|
|
||
| fn main() { | ||
| let w = Wrapper([11, 22]); | ||
| let arr: [u8; 2] = unsafe { *((&w) as *const Wrapper as *const [u8; 2]) }; | ||
| assert_eq!(arr, [11, 22]); | ||
| } |
39 changes: 39 additions & 0 deletions
39
.../tests/integration/data/prove-rs/show/ptr-cast-array-to-nested-wrapper-fail.main.expected
This file contains hidden or 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,39 @@ | ||
|
|
||
| ┌─ 1 (root, init) | ||
| │ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC | ||
| │ span: 0 | ||
| │ | ||
| │ (128 steps) | ||
| ├─ 3 | ||
| │ #expect ( thunk ( #applyBinOp ( binOpEq , thunk ( #applyBinOp ( binOpBitAnd , th | ||
| │ function: main | ||
| ┃ | ||
| ┃ (1 step) | ||
| ┣━━┓ | ||
| ┃ │ | ||
| ┃ ├─ 4 | ||
| ┃ │ AssertError ( assertMessageMisalignedPointerDereference ( ... required: operandC | ||
| ┃ │ function: main | ||
| ┃ │ | ||
| ┃ │ (1 step) | ||
| ┃ └─ 6 (stuck, leaf) | ||
| ┃ #ProgramError ( AssertError ( assertMessageMisalignedPointerDereference ( ... re | ||
| ┃ function: main | ||
| ┃ | ||
| ┗━━┓ | ||
| │ | ||
| ├─ 5 | ||
| │ #execBlockIdx ( basicBlockIdx ( 4 ) ) ~> .K | ||
| │ function: main | ||
| │ | ||
| │ (11 steps) | ||
| └─ 7 (stuck, leaf) | ||
| #traverseProjection ( toLocal ( 1 ) , Aggregate ( variantIdx ( 0 ) , ListItem ( | ||
| function: main | ||
| span: 282 | ||
|
|
||
|
|
||
| ┌─ 2 (root, leaf, target, terminal) | ||
| │ #EndProgram ~> .K | ||
|
|
||
|
|
39 changes: 39 additions & 0 deletions
39
...tegration/data/prove-rs/show/ptr-cast-array-to-singleton-wrapped-array-fail.main.expected
This file contains hidden or 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,39 @@ | ||
|
|
||
| ┌─ 1 (root, init) | ||
| │ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC | ||
| │ span: 0 | ||
| │ | ||
| │ (128 steps) | ||
| ├─ 3 | ||
| │ #expect ( thunk ( #applyBinOp ( binOpEq , thunk ( #applyBinOp ( binOpBitAnd , th | ||
| │ function: main | ||
| ┃ | ||
| ┃ (1 step) | ||
| ┣━━┓ | ||
| ┃ │ | ||
| ┃ ├─ 4 | ||
| ┃ │ AssertError ( assertMessageMisalignedPointerDereference ( ... required: operandC | ||
| ┃ │ function: main | ||
| ┃ │ | ||
| ┃ │ (1 step) | ||
| ┃ └─ 6 (stuck, leaf) | ||
| ┃ #ProgramError ( AssertError ( assertMessageMisalignedPointerDereference ( ... re | ||
| ┃ function: main | ||
| ┃ | ||
| ┗━━┓ | ||
| │ | ||
| ├─ 5 | ||
| │ #execBlockIdx ( basicBlockIdx ( 4 ) ) ~> .K | ||
| │ function: main | ||
| │ | ||
| │ (10 steps) | ||
| └─ 7 (stuck, leaf) | ||
| #traverseProjection ( toLocal ( 1 ) , Aggregate ( variantIdx ( 0 ) , ListItem ( | ||
| function: main | ||
| span: 282 | ||
|
|
||
|
|
||
| ┌─ 2 (root, leaf, target, terminal) | ||
| │ #EndProgram ~> .K | ||
|
|
||
|
|
40 changes: 40 additions & 0 deletions
40
kmir/src/tests/integration/data/prove-rs/show/ptr-cast-array-to-wrapper-fail.main.expected
This file contains hidden or 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,40 @@ | ||
|
|
||
| ┌─ 1 (root, init) | ||
| │ #execTerminator ( terminator ( ... kind: terminatorKindCall ( ... func: operandC | ||
| │ span: 0 | ||
| │ | ||
| │ (128 steps) | ||
| ├─ 3 | ||
| │ #expect ( thunk ( #applyBinOp ( binOpEq , thunk ( #applyBinOp ( binOpBitAnd , th | ||
| │ function: main | ||
| ┃ | ||
| ┃ (1 step) | ||
| ┣━━┓ | ||
| ┃ │ | ||
| ┃ ├─ 4 | ||
| ┃ │ AssertError ( assertMessageMisalignedPointerDereference ( ... required: operandC | ||
| ┃ │ function: main | ||
| ┃ │ | ||
| ┃ │ (1 step) | ||
| ┃ └─ 6 (stuck, leaf) | ||
| ┃ #ProgramError ( AssertError ( assertMessageMisalignedPointerDereference ( ... re | ||
| ┃ function: main | ||
| ┃ | ||
| ┗━━┓ | ||
| │ | ||
| ├─ 5 | ||
| │ #execBlockIdx ( basicBlockIdx ( 4 ) ) ~> .K | ||
| │ function: main | ||
| │ | ||
| │ (154 steps) | ||
| ├─ 7 (terminal) | ||
| │ #EndProgram ~> .K | ||
| │ function: main | ||
| │ | ||
| ┊ constraint: true | ||
| ┊ subst: ... | ||
| └─ 2 (leaf, target, terminal) | ||
| #EndProgram ~> .K | ||
|
|
||
|
|
||
|
|
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.