-
-
Notifications
You must be signed in to change notification settings - Fork 15k
rustllvm: Use report_fatal_error instead of llvm_unreachable #44020
Copy link
Copy link
Closed
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-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.
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.P-mediumMedium priorityMedium priorityT-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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Some functions in rustllvm rely on
llvm_unreachableto catch errors. However, in release modellvm_unreachableexpands to the C++ compiler's equivalent ofintrinsics::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 ofllvm_unreachablein rustllvm should be audited and replaced withreport_fatal_errorunless the potential-UB is intended.