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.
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.