Skip to content

LLVM assert abort while trying to take address of raw pointer in static #13973

Closed
@Kimundi

Description

@Kimundi

Testcase:

fn main() {
    unsafe {
        static BLOCK_UNSAFE_SAFE_PTR: &'static int = &*(0xdeadbeef as *int);
    }
}

Output:

rustc: /build/rust-git/src/rust/src/llvm/include/llvm/Support/Casting.h:237: typename llvm::cast_retty<X, Y*>::ret_type llvm::cast(Y*) [with X = llvm::GlobalVariable; Y = llvm::Value; typename llvm::cast_retty<X, Y*>::ret_type = llvm::GlobalVariable*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
fish: Job 1, “rustc bug_generic_static_function_ptr.rs ” terminated by signal SIGABRT (Abort)

Metadata

Metadata

Assignees

Labels

A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-codegenArea: Code generationE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions