[Openmp-commits] [PATCH] D111562: [OpenMP] libomp: fix warning on comparison of integer expressions of different signedness

Andrey Churbanov via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Oct 11 10:25:39 PDT 2021


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

Luke Benes <lukebenes at hotmail.com> reported the warning:

[2685/5155] Building CXX object projects/openmp/runtime/src/CMakeFiles/omp.dir/kmp_settings.cpp.o
/llvm-project/openmp/runtime/src/kmp_settings.cpp: In function ‘void __kmp_check_stksize(size_t*)’:
/llvm-project/openmp/runtime/src/kmp_settings.cpp:305:12: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘long int’ [-Wsign-compare]

  305 |   if (*val < KMP_MIN_STKSIZE)

The patch replaces macro with global variable.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D111562

Files:
  openmp/runtime/src/kmp_settings.cpp


Index: openmp/runtime/src/kmp_settings.cpp
===================================================================
--- openmp/runtime/src/kmp_settings.cpp
+++ openmp/runtime/src/kmp_settings.cpp
@@ -302,8 +302,8 @@
   // if system stack size is too big then limit the size for worker threads
   if (*val > KMP_DEFAULT_STKSIZE * 16) // just a heuristics...
     *val = KMP_DEFAULT_STKSIZE * 16;
-  if (*val < KMP_MIN_STKSIZE)
-    *val = KMP_MIN_STKSIZE;
+  if (*val < __kmp_sys_min_stksize)
+    *val = __kmp_sys_min_stksize;
   if (*val > KMP_MAX_STKSIZE)
     *val = KMP_MAX_STKSIZE; // dead code currently, but may work in future
 #if KMP_OS_DARWIN


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D111562.378718.patch
Type: text/x-patch
Size: 648 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20211011/b4db2cb6/attachment.bin>


More information about the Openmp-commits mailing list