[Openmp-commits] [PATCH] D95818: [OpenMP] Fix sign comparison warnings from GCC

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Mon Feb 1 13:55:27 PST 2021


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

New affinity patch introduced legitimate sign-compare warnings that clang doesn't report but GCC-10 does. This removes the warnings by changing two variables types to unsigned.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95818

Files:
  openmp/runtime/src/kmp_affinity.cpp


Index: openmp/runtime/src/kmp_affinity.cpp
===================================================================
--- openmp/runtime/src/kmp_affinity.cpp
+++ openmp/runtime/src/kmp_affinity.cpp
@@ -109,8 +109,8 @@
     }
     bool radix1 = true;
     bool all_same = true;
-    int id1 = addrP[0].first.labels[top_index1];
-    int id2 = addrP[0].first.labels[top_index2];
+    unsigned id1 = addrP[0].first.labels[top_index1];
+    unsigned id2 = addrP[0].first.labels[top_index2];
     int pref1 = preference[type1];
     int pref2 = preference[type2];
     for (int hwidx = 1; hwidx < nTh; ++hwidx) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95818.320591.patch
Type: text/x-patch
Size: 601 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20210201/6d7633c7/attachment.bin>


More information about the Openmp-commits mailing list