-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crucible-mir: Properly parse ArrayToPointer casts
Although `crucible-mir` had support for translating these sorts of casts, it did not parse them properly. This patch adds a dedicated `ArrayToPointer` `CastKind` and ensures that it is handled properly in the `crucible-mir` JSON parser and translator. Fixes #1224.
- Loading branch information
1 parent
2909c22
commit b07ad45
Showing
5 changed files
with
28 additions
and
1 deletion.
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
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
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,20 @@ | ||
type T = u64; | ||
const COUNT: usize = 16; | ||
|
||
pub fn output_array(src: &[T; COUNT], dst: *mut T) { | ||
unsafe { | ||
std::ptr::copy(src as *const T, dst, COUNT); | ||
} | ||
} | ||
|
||
#[cfg_attr(crux, crux::test)] | ||
pub fn crux_test() -> T { | ||
let src: &[T; COUNT] = &[42; COUNT]; | ||
let dst: &mut [T; COUNT] = &mut [0; COUNT]; | ||
output_array(src, dst as *mut T); | ||
dst[0] | ||
} | ||
|
||
pub fn main() { | ||
println!("{:?}", crux_test()); | ||
} |