-
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 (`ArrayToPointer` casts), it did not parse them properly. This patch ensures that `ArrayToPointer` casts are parsed as `Misc`, which allows them to be handled by the code in `Mir.Trans`. Fixes #1224.
- Loading branch information
1 parent
2909c22
commit edddf4b
Showing
3 changed files
with
26 additions
and
0 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
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()); | ||
} |