[libcxx-commits] [PATCH] D148630: [libc++abi] Make the error message for recursive initialization of function-local statics more explicit
Louis Dionne via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Apr 18 05:49:15 PDT 2023
ldionne created this revision.
Herald added a project: All.
ldionne requested review of this revision.
Herald added a project: libc++abi.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++abi.
The new message is a bit verbose, but it makes it clearer that this isn't
a problem in libc++abi, but instead a problem in the user's code. Otherwise,
we get bugs sent down to libc++abi because people see this message in their
crash logs.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D148630
Files:
libcxxabi/src/cxa_guard_impl.h
Index: libcxxabi/src/cxa_guard_impl.h
===================================================================
--- libcxxabi/src/cxa_guard_impl.h
+++ libcxxabi/src/cxa_guard_impl.h
@@ -255,7 +255,7 @@
if (*init_byte_address == COMPLETE_BIT)
return true;
if (*init_byte_address & PENDING_BIT)
- ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization");
+ ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization: do you have a function-local static variable whose initialization depends on that function?");
*init_byte_address = PENDING_BIT;
return false;
}
@@ -325,7 +325,7 @@
// Check for possible recursive initialization.
if (has_thread_id_support && (*init_byte_address & PENDING_BIT)) {
if (*thread_id_address == current_thread_id.get())
- ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization");
+ ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization: do you have a function-local static variable whose initialization depends on that function?");
}
// Wait until the pending bit is not set.
@@ -460,7 +460,7 @@
// Check for recursive initialization
if (has_thread_id_support && thread_id.load(std::_AO_Relaxed) == current_thread_id.get()) {
- ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization");
+ ABORT_WITH_MESSAGE("__cxa_guard_acquire detected recursive initialization: do you have a function-local static variable whose initialization depends on that function?");
}
if ((last_val & WAITING_BIT) == 0) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148630.514621.patch
Type: text/x-patch
Size: 1650 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230418/cd95c07e/attachment-0001.bin>
More information about the libcxx-commits
mailing list