-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.O-windows-msvcToolchain: MSVC, Operating system: WindowsToolchain: MSVC, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
This is most likely responsible for the windows failures from #43931 when the __getit
function, which may return a reference to a #[thread_local] static
, was #[inline]
(cc @alexcrichton):
// a.rs
#![crate_type = "dylib"]
#![feature(thread_local)]
#[thread_local]
static FOO: u32 = 25;
pub fn addr() -> *const u32 {
&FOO
}
#[inline]
pub fn addr_inline() -> *const u32 {
&FOO
}
// b.rs
extern crate a;
fn main() {
assert_eq!(a::addr(), a::addr_inline());
}
Running b
, on x64 MSVC (thanks, @bcata6!) results in:
thread 'main' panicked at 'assertion failed: `(left == right)`
left: `0x134cb61ace4`,
right: `0x134cb6139c0`', b.rs:4:4
retep998
Metadata
Metadata
Assignees
Labels
A-thread-localsArea: Thread local storage (TLS)Area: Thread local storage (TLS)C-bugCategory: This is a bug.Category: This is a bug.O-windows-msvcToolchain: MSVC, Operating system: WindowsToolchain: MSVC, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.