Skip to content

Commit

Permalink
Install the bad-alloc handler before fatal errors
Browse files Browse the repository at this point in the history
The bad-alloc installer was incorrectly asserting that the other handler
isn't set yet, instead of checking its own, but we can avoid that by
changing the order we install them.

Ref: llvm/llvm-project#83040
  • Loading branch information
cuviper committed Mar 15, 2024
1 parent adf57a7 commit 8d374b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ static void BadAllocErrorHandler(void *UserData,
}

extern "C" void LLVMRustInstallErrorHandlers() {
install_fatal_error_handler(FatalErrorHandler);
install_bad_alloc_error_handler(BadAllocErrorHandler);
install_fatal_error_handler(FatalErrorHandler);
install_out_of_memory_new_handler();
}

Expand Down

0 comments on commit 8d374b1

Please sign in to comment.