-
Notifications
You must be signed in to change notification settings - Fork 341
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make another test more robust against random alignment
- Loading branch information
Showing
6 changed files
with
40 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
// error-pattern: but alignment 4 is required | ||
|
||
fn main() { | ||
let mut x = [0u8; 20]; | ||
let x_ptr: *mut u8 = x.as_mut_ptr(); | ||
// At least one of these is definitely unaligned. | ||
// Currently, we guarantee to complain about the first one already (https://github.com/rust-lang/miri/issues/1074). | ||
unsafe { | ||
*(x_ptr as *mut u64) = 42; //~ ERROR accessing memory with alignment 1, but alignment | ||
*(x_ptr.add(1) as *mut u64) = 42; | ||
*(x_ptr as *mut u32) = 42; | ||
*(x_ptr.add(1) as *mut u32) = 42; | ||
} | ||
panic!("unreachable in miri"); | ||
} |
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