]> git.lizzy.rs Git - rust.git/blob - src/test/ui/simd/issue-32947.rs
Add 'src/tools/rust-analyzer/' from commit '977e12a0bdc3e329af179ef3a9d466af9eb613bb'
[rust.git] / src / test / ui / simd / issue-32947.rs
1 // run-pass
2 // ignore-emscripten FIXME(#45351)
3
4 #![feature(repr_simd, test)]
5
6 extern crate test;
7
8 #[repr(simd)]
9 pub struct Mu64(pub u64, pub u64, pub u64, pub u64);
10
11 fn main() {
12     // This ensures an unaligned pointer even in optimized builds, though LLVM
13     // gets enough type information to actually not mess things up in that case,
14     // but at the time of writing this, it's enough to trigger the bug in
15     // non-optimized builds
16     unsafe {
17         let memory = &mut [0u64; 8] as *mut _ as *mut u8;
18         let misaligned_ptr: &mut [u8; 32] = {
19             std::mem::transmute(memory.offset(1))
20         };
21         *misaligned_ptr = std::mem::transmute(Mu64(1, 1, 1, 1));
22         test::black_box(memory);
23     }
24 }