forgot to add alignment test loop in one test
This commit is contained in:
parent
066fa629f2
commit
d5b15297ac
@ -1 +1 @@
|
||||
8cdc94e84040ce797fd33d0a7cfda4ec4f2f2421
|
||||
515c9fa505e18a65d7f61bc3e9eb833b79a68618
|
||||
|
@ -1,6 +1,8 @@
|
||||
// error-pattern: but alignment 4 is required
|
||||
|
||||
fn main() {
|
||||
// No retry needed, this fails reliably.
|
||||
|
||||
let mut x = [0u8; 20];
|
||||
let x_ptr: *mut u8 = x.as_mut_ptr();
|
||||
// At least one of these is definitely unaligned.
|
||||
|
@ -6,6 +6,7 @@
|
||||
struct MuchAlign;
|
||||
|
||||
fn main() {
|
||||
for _ in 0..10 { // Try many times as this might work by chance.
|
||||
let buf = [0u32; 256];
|
||||
// `buf` is sufficiently aligned for `layout.align` on a `dyn Debug`, but not
|
||||
// for the actual alignment required by `MuchAlign`.
|
||||
@ -17,3 +18,4 @@ fn main() {
|
||||
// Re-borrow that. This should be UB.
|
||||
let _ptr = &*ptr; //~ERROR alignment 256 is required
|
||||
}
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
fn main() {
|
||||
let x = &mut [0u8; 3];
|
||||
let base_addr = x as *mut _ as usize;
|
||||
// Manually make sure the pointer is properly aligned.
|
||||
let base_addr_aligned = if base_addr % 2 == 0 { base_addr } else { base_addr+1 };
|
||||
let u16_ptr = base_addr_aligned as *mut u16;
|
||||
unsafe { *u16_ptr = 2; } //~ERROR memory with alignment 1, but alignment 2 is required
|
||||
|
@ -2,11 +2,11 @@
|
||||
// compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows
|
||||
|
||||
fn main() {
|
||||
for _ in 0..10 { // Try many times as this might work by chance.
|
||||
// No retry needed, this fails reliably.
|
||||
|
||||
let x = [2u32, 3]; // Make it big enough so we don't get an out-of-bounds error.
|
||||
let x = (x.as_ptr() as *const u8).wrapping_offset(3) as *const u32;
|
||||
// This must fail because alignment is violated: the offset is not sufficiently aligned.
|
||||
// Also make the offset not a power of 2, that used to ICE.
|
||||
let _x = unsafe { *x }; //~ERROR memory with alignment 1, but alignment 4 is required
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ fn main() {
|
||||
let x = &x[0] as *const _ as *const *const u8; // cast to ptr-to-ptr, so that we load a ptr
|
||||
// This must fail because alignment is violated. Test specifically for loading pointers,
|
||||
// which have special code in miri's memory.
|
||||
let _x = unsafe { *x };
|
||||
//~^ ERROR but alignment
|
||||
let _x = unsafe { *x }; //~ERROR but alignment
|
||||
}
|
||||
}
|
||||
|
@ -2,9 +2,10 @@
|
||||
// compile-flags: -Zmiri-disable-validation
|
||||
|
||||
fn main() {
|
||||
for _ in 0..10 { // Try many times as this might work by chance.
|
||||
let x = &2u8;
|
||||
let x = x as *const _ as *const [u32; 0];
|
||||
// This must fail because alignment is violated. Test specifically for loading ZST.
|
||||
let _x = unsafe { *x };
|
||||
//~^ ERROR alignment 4 is required
|
||||
let _x = unsafe { *x }; //~ERROR alignment 4 is required
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user