Skip to content

Commit 498c4b6

Browse files
[OpenMP] libomp: fix build by clang-cl with vs2019
Problem reported by Joseph Shen <[email protected]>. The patch changes *(&<atomic-var>) to (&<atomic-var>)->load(). Differential Revision: https://reviews.llvm.org/D95485
1 parent dfb558b commit 498c4b6

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

openmp/runtime/src/z_Windows_NT_util.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,10 @@ static void __kmp_win32_cond_wait(kmp_win32_cond_t *cv, kmp_win32_mutex_t *mx,
239239
old_f = flag->unset_sleeping();
240240
KMP_DEBUG_ASSERT(old_f & KMP_BARRIER_SLEEP_STATE);
241241
TCW_PTR(th->th.th_sleep_loc, NULL);
242-
KF_TRACE(50, ("__kmp_win32_cond_wait: exiting, condition "
243-
"fulfilled: flag's loc(%p): %u => %u\n",
244-
flag->get(), old_f, *(flag->get())));
242+
KF_TRACE(50,
243+
("__kmp_win32_cond_wait: exiting, condition "
244+
"fulfilled: flag's loc(%p): %u => %u\n",
245+
flag->get(), (unsigned int)old_f, (unsigned int)flag->load()));
245246

246247
__kmp_win32_mutex_lock(&cv->waiters_count_lock_);
247248
KMP_DEBUG_ASSERT(cv->waiters_count_ > 0);
@@ -380,8 +381,8 @@ static inline void __kmp_suspend_template(int th_gtid, C *flag) {
380381
}
381382

382383
KF_TRACE(5, ("__kmp_suspend_template: T#%d set sleep bit for flag's"
383-
" loc(%p)==%d\n",
384-
th_gtid, flag->get(), *(flag->get())));
384+
" loc(%p)==%u\n",
385+
th_gtid, flag->get(), (unsigned int)flag->load()));
385386

386387
if (flag->done_check_val(old_spin)) {
387388
old_spin = flag->unset_sleeping();
@@ -493,7 +494,8 @@ static inline void __kmp_resume_template(int target_gtid, C *flag) {
493494
if (!flag->is_sleeping_val(old_spin)) {
494495
KF_TRACE(5, ("__kmp_resume_template: T#%d exiting, thread T#%d already "
495496
"awake: flag's loc(%p): %u => %u\n",
496-
gtid, target_gtid, flag->get(), old_spin, *(flag->get())));
497+
gtid, target_gtid, flag->get(), (unsigned int)old_spin,
498+
(unsigned int)flag->load()));
497499
__kmp_unlock_suspend_mx(th);
498500
return;
499501
}
@@ -591,7 +593,8 @@ void __kmp_affinity_bind_thread(int proc) {
591593
}
592594

593595
void __kmp_affinity_determine_capable(const char *env_var) {
594-
// All versions of Windows* OS (since Win '95) support SetThreadAffinityMask().
596+
// All versions of Windows* OS (since Win '95) support
597+
// SetThreadAffinityMask().
595598

596599
#if KMP_GROUP_AFFINITY
597600
KMP_AFFINITY_ENABLE(__kmp_num_proc_groups * sizeof(DWORD_PTR));
@@ -950,8 +953,7 @@ kmp_uint64 __kmp_now_nsec() {
950953
return 1e9 * __kmp_win32_tick * now.QuadPart;
951954
}
952955

953-
extern "C"
954-
void *__stdcall __kmp_launch_worker(void *arg) {
956+
extern "C" void *__stdcall __kmp_launch_worker(void *arg) {
955957
volatile void *stack_data;
956958
void *exit_val;
957959
void *padding = 0;

0 commit comments

Comments
 (0)