[Openmp-commits] [PATCH] D159369: [OpenMP] Fix a wrong assertion in `__kmp_get_global_thread_id`
Shilei Tian via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Fri Sep 1 11:12:25 PDT 2023
tianshilei1992 updated this revision to Diff 555445.
tianshilei1992 added a comment.
make it clear
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D159369/new/
https://reviews.llvm.org/D159369
Files:
openmp/runtime/src/kmp_runtime.cpp
Index: openmp/runtime/src/kmp_runtime.cpp
===================================================================
--- openmp/runtime/src/kmp_runtime.cpp
+++ openmp/runtime/src/kmp_runtime.cpp
@@ -178,7 +178,12 @@
if (stack_diff <= stack_size) {
/* The only way we can be closer than the allocated */
/* stack size is if we are running on this thread. */
- KMP_DEBUG_ASSERT(__kmp_gtid_get_specific() == i);
+ // __kmp_gtid_get_specific can return negative value because this
+ // function can be called by thread destructor. However, before the
+ // thread destructor is called, the value of the corresponding
+ // thread-specific data will be reset to NULL.
+ KMP_DEBUG_ASSERT(__kmp_gtid_get_specific() < 0 ||
+ __kmp_gtid_get_specific() == i);
return i;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D159369.555445.patch
Type: text/x-patch
Size: 867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20230901/62aa2e0c/attachment.bin>
More information about the Openmp-commits
mailing list