2020-08-17 10:09:09 -05:00
|
|
|
// error-pattern: but alignment 4 is required
|
2022-03-17 08:49:10 -05:00
|
|
|
// normalize-stderr-test: "\.add\(1\)" -> " "
|
2020-08-17 10:09:09 -05:00
|
|
|
|
2016-07-06 04:19:24 -05:00
|
|
|
fn main() {
|
2020-08-18 03:11:54 -05:00
|
|
|
// No retry needed, this fails reliably.
|
|
|
|
|
2016-07-06 04:19:24 -05:00
|
|
|
let mut x = [0u8; 20];
|
2020-04-13 10:51:22 -05:00
|
|
|
let x_ptr: *mut u8 = x.as_mut_ptr();
|
2020-04-14 02:50:20 -05:00
|
|
|
// At least one of these is definitely unaligned.
|
2016-07-06 04:19:24 -05:00
|
|
|
unsafe {
|
2022-03-17 08:49:10 -05:00
|
|
|
*(x_ptr as *mut u32) = 42;
|
2020-08-17 10:09:09 -05:00
|
|
|
*(x_ptr.add(1) as *mut u32) = 42;
|
2016-07-06 04:19:24 -05:00
|
|
|
}
|
|
|
|
}
|