]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/issue-44056-macos-tls-align.rs
Suggest defining type parameter when appropriate
[rust.git] / src / test / codegen / issue-44056-macos-tls-align.rs
1 // ignore-tidy-linelength
2 // only-macos
3 // no-system-llvm
4 // compile-flags: -O
5
6 #![crate_type = "rlib"]
7 #![feature(thread_local)]
8
9 // CHECK: @STATIC_VAR_1 = thread_local local_unnamed_addr global <{ [32 x i8] }> zeroinitializer, section "__DATA,__thread_bss", align 4
10 #[no_mangle]
11 #[thread_local]
12 static mut STATIC_VAR_1: [u32; 8] = [0; 8];
13
14 // CHECK: @STATIC_VAR_2 = thread_local local_unnamed_addr global <{ [32 x i8] }> <{{[^>]*}}>, section "__DATA,__thread_data", align 4
15 #[no_mangle]
16 #[thread_local]
17 static mut STATIC_VAR_2: [u32; 8] = [4; 8];
18
19 #[no_mangle]
20 pub unsafe fn f(x: &mut [u32; 8]) {
21     std::mem::swap(x, &mut STATIC_VAR_1)
22 }
23
24 #[no_mangle]
25 pub unsafe fn g(x: &mut [u32; 8]) {
26     std::mem::swap(x, &mut STATIC_VAR_2)
27 }