[Openmp-commits] [PATCH] D126564: [OpenMP] allow loc to be NULL in __kmp_determine_reduction_method to accommodate MSVC

Vadim Paretsky via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri May 27 13:35:08 PDT 2022


vadikp-intel created this revision.
vadikp-intel added reviewers: tlwilmar, jlpeyton.
vadikp-intel added a project: OpenMP.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
vadikp-intel requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.

MSVC may not supply source location information to __kmpc_reduce passing NULL for the value. The patch adds a check for the loc value being NULL in __kmp_determine_reduction_method.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126564

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
@@ -8707,7 +8707,7 @@
   KMP_DEBUG_ASSERT(lck); // it would be nice to test ( lck != 0 )
 
 #define FAST_REDUCTION_ATOMIC_METHOD_GENERATED                                 \
-  ((loc->flags & (KMP_IDENT_ATOMIC_REDUCE)) == (KMP_IDENT_ATOMIC_REDUCE))
+  (loc && ((loc->flags & (KMP_IDENT_ATOMIC_REDUCE)) == (KMP_IDENT_ATOMIC_REDUCE)))
 #define FAST_REDUCTION_TREE_METHOD_GENERATED ((reduce_data) && (reduce_func))
 
   retval = critical_reduce_block;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126564.432618.patch
Type: text/x-patch
Size: 636 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220527/11acfe7d/attachment.bin>


More information about the Openmp-commits mailing list