[llvm] Fix crash in install_bad_alloc_error_handler (PR #83160)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 27 09:45:16 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-support

Author: Fabian Schiebel (fabianbs96)

<details>
<summary>Changes</summary>

Fixes #<!-- -->83040

---
Full diff: https://github.com/llvm/llvm-project/pull/83160.diff


1 Files Affected:

- (modified) llvm/lib/Support/ErrorHandling.cpp (+2-1) 


``````````diff
diff --git a/llvm/lib/Support/ErrorHandling.cpp b/llvm/lib/Support/ErrorHandling.cpp
index b8b3b7424ac6b1..d2d3dcc2f478c5 100644
--- a/llvm/lib/Support/ErrorHandling.cpp
+++ b/llvm/lib/Support/ErrorHandling.cpp
@@ -130,7 +130,8 @@ void llvm::install_bad_alloc_error_handler(fatal_error_handler_t handler,
 #if LLVM_ENABLE_THREADS == 1
   std::lock_guard<std::mutex> Lock(BadAllocErrorHandlerMutex);
 #endif
-  assert(!ErrorHandler && "Bad alloc error handler already registered!\n");
+  assert(!BadAllocErrorHandler &&
+         "Bad alloc error handler already registered!\n");
   BadAllocErrorHandler = handler;
   BadAllocErrorHandlerUserData = user_data;
 }

``````````

</details>


https://github.com/llvm/llvm-project/pull/83160


More information about the llvm-commits mailing list