]> git.lizzy.rs Git - rust.git/blob - tests/codegen/issue-44056-macos-tls-align.rs
Rollup merge of #107756 - RalfJung:miri-out-of-addresses, r=oli-obk
[rust.git] / tests / codegen / issue-44056-macos-tls-align.rs
1 //
2 // only-macos
3 // no-system-llvm
4 // compile-flags: -O
5
6 #![crate_type = "rlib"]
7 #![feature(thread_local)]
8
9 // local_unnamed_addr does not appear when std is built with debug assertions.
10 // CHECK: @STATIC_VAR_1 = thread_local {{(local_unnamed_addr )?}}global <{ [32 x i8] }> zeroinitializer, section "__DATA,__thread_bss", align 4
11 #[no_mangle]
12 #[thread_local]
13 static mut STATIC_VAR_1: [u32; 8] = [0; 8];
14
15 // CHECK: @STATIC_VAR_2 = thread_local {{(local_unnamed_addr )?}}global <{ [32 x i8] }> <{{[^>]*}}>, section "__DATA,__thread_data", align 4
16 #[no_mangle]
17 #[thread_local]
18 static mut STATIC_VAR_2: [u32; 8] = [4; 8];
19
20 #[no_mangle]
21 pub unsafe fn f(x: &mut [u32; 8]) {
22     std::mem::swap(x, &mut STATIC_VAR_1)
23 }
24
25 #[no_mangle]
26 pub unsafe fn g(x: &mut [u32; 8]) {
27     std::mem::swap(x, &mut STATIC_VAR_2)
28 }