diff options
author | Shilei Tian <i@tianshilei.me> | 2023-09-06 12:21:18 -0400 |
---|---|---|
committer | Shilei Tian <i@tianshilei.me> | 2023-09-06 12:21:43 -0400 |
commit | ff5c7261ef01393acad207a10b6ea8fd579206ef (patch) | |
tree | 26d909b17d120182b24299d08e5260b5ce6df3da /clang/lib/Basic/SourceManager.cpp | |
parent | 518b08c193cc356f4c85b6402b9352279d37db3a (diff) | |
download | llvm-ff5c7261ef01393acad207a10b6ea8fd579206ef.zip llvm-ff5c7261ef01393acad207a10b6ea8fd579206ef.tar.gz llvm-ff5c7261ef01393acad207a10b6ea8fd579206ef.tar.bz2 |
[OpenMP] Fix a wrong assertion in `__kmp_get_global_thread_id`
The function assumes that `__kmp_gtid_get_specific` always returns a valid gtid.
That is not always true, because when creating the key for thread-specific data,
a destructor is assigned. The dtor will be called at thread exit. However, before
the dtor is called, the thread-specific data will be reset to NULL first
(https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_key_create.html):
> At thread exit, if a key value has a non-NULL destructor pointer, and the thread
> has a non-NULL value associated with that key, the value of the key is set to NULL.
This will lead to that `__kmp_gtid_get_specific` returns `KMP_GTID_DNE`.
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D159369
Diffstat (limited to 'clang/lib/Basic/SourceManager.cpp')
0 files changed, 0 insertions, 0 deletions