Skip to content

Statics should not be able to take the address of a thread_local static #18712

Closed
@alexcrichton

Description

@alexcrichton

Not sure if this is a codegen bug or just something that's not supported by LLVM

#![feature(thread_local)]

#[thread_local]
static FOO: uint = 0;
static BAR: &'static uint = &FOO;

fn main() {
    println!("{}", *BAR);
}
$ rustc foo.rs && ./foo
282584257676671
$ rustc foo.rs --opt-level=3 && ./foo
0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationC-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions