Skip to content

rustllvm: Use report_fatal_error instead of llvm_unreachable #44020

Closed
@hanna-kruppe

Description

@hanna-kruppe

Some functions in rustllvm rely on llvm_unreachable to catch errors. However, in release mode llvm_unreachable expands to the C++ compiler's equivalent of intrinsics::unreachable() (i.e., it's a hint to the optimizer and UB to execute). This subverts the intent of several functions, causing us to execute UB instead of crashing as intended. All uses of llvm_unreachable in rustllvm should be audited and replaced with report_fatal_error unless the potential-UB is intended.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.P-mediumMedium priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions