Skip to content

Unreachable *bool read causes ICE #7246

Closed
@talchas

Description

@talchas
pub unsafe fn main() {
    return; 
    if *ptr::null() {}
}

temp.rs:3:12: 3:30 warning: unreachable expression
temp.rs:3 return; if ptr::null() {}
^~~~~~~~~~~~~~~~~~
rustc: /home/ben/apps/rust/src/llvm/include/llvm/Support/Casting.h:231: typename llvm::enable_if<llvm::is_same<Y, typename llvm::simplify_type::SimpleType>, typename llvm::cast_retty<X, Y
>::ret_type>::type llvm::cast(Y_) [with X = llvm::SequentialType, Y = llvm::Type, typename llvm::enable_if<llvm::is_same<Y, typename llvm::simplify_type::SimpleType>, typename llvm::cast_retty<X, Y_>::ret_type>::type = llvm::SequentialType*]: Assertion `isa(Val) && "cast() argument of incompatible type!"' failed.

Happens at least with the (a bit out of date) master 2d28d64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationI-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