[PATCH] D21803: [libcxxabi] Provide a fallback __cxa_thread_atexit() implementation

Eric Fiselier via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 6 17:45:34 PDT 2016

EricWF added a comment.

LGTM modulo bug fix.

Comment at: src/cxa_thread_atexit.cpp:70
@@ +69,3 @@
+    while (auto head = dtors) {
+      dtors = head->next;
+      head->dtor(head->obj);
There is a bug here. If `head->next == nullptr` and if `head->dtor(head->obj))` creates a TL variable in the destructor then that destructor will not be invoked.

Here's an updated test case which catches the bug: https://gist.github.com/EricWF/3bb50d4f28b91aa28d2adefea0e94a0e


More information about the cfe-commits mailing list