]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/issue-44056-macos-tls-align.rs
Enable emission of alignment attrs for pointer params
[rust.git] / src / test / codegen / issue-44056-macos-tls-align.rs
1 // Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // ignore-tidy-linelength
12 // only-macos
13 // no-system-llvm
14 // compile-flags: -O
15
16 #![crate_type = "rlib"]
17 #![feature(thread_local)]
18
19 // CHECK: @STATIC_VAR_1 = thread_local local_unnamed_addr global <{ [32 x i8] }> zeroinitializer, section "__DATA,__thread_bss", align 4
20 #[no_mangle]
21 #[thread_local]
22 static mut STATIC_VAR_1: [u32; 8] = [0; 8];
23
24 // CHECK: @STATIC_VAR_2 = thread_local local_unnamed_addr global <{ [32 x i8] }> <{{[^>]*}}>, section "__DATA,__thread_data", align 4
25 #[no_mangle]
26 #[thread_local]
27 static mut STATIC_VAR_2: [u32; 8] = [4; 8];
28
29 #[no_mangle]
30 pub unsafe fn f(x: &mut [u32; 8]) {
31     std::mem::swap(x, &mut STATIC_VAR_1)
32 }
33
34 #[no_mangle]
35 pub unsafe fn g(x: &mut [u32; 8]) {
36     std::mem::swap(x, &mut STATIC_VAR_2)
37 }