[PATCH] D135919: [Clang] Set thread_local Itanium ABI guard variables before calling constructors.
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Oct 14 16:35:01 PDT 2022
rjmccall added a comment.
Please add a comment something like this:
The semantics of dynamic initialization of thread-local variables depends subtly on whether they are block-scope. The initialization of block-scope thread locals can be aborted with an exception and later retried (<cite>), and recursive entry to the initialization has undefined behavior (<cite>). For non-block thread locals, exceptions lead to termination (<cite>), and recursive references to the variables are governed only by the lifetime rules (<cite>), which means they’re perfectly fine as long as they avoid touching memory. As a result, we need to avoid marking block-scope variables as initialized until after initialization completes (or be prepared revert the mark after an exception), but we need to mark non-block-scope variables as initialized immediately so that non-memory-accessing uses will succeed.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D135919/new/
https://reviews.llvm.org/D135919
More information about the cfe-commits
mailing list