[Openmp-commits] [PATCH] D90954: [OpenMP] Fix potential division by 0

Nawrin Sultana via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Nov 6 09:59:41 PST 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG082031949cce: [OpenMP] Fix potential division by 0 (authored by Nawrin).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90954/new/

https://reviews.llvm.org/D90954

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
@@ -589,6 +589,8 @@
     else
       __kmp_nThreadsPerCore = 1; // no CORE found
     __kmp_ncores = __kmp_xproc / __kmp_nThreadsPerCore;
+    if (nCoresPerPkg == 0)
+      nCoresPerPkg = 1; // to prevent possible division by 0
     nPackages = (__kmp_xproc + nCoresPerPkg - 1) / nCoresPerPkg;
     if (__kmp_affinity_verbose) {
       KMP_INFORM(AffNotCapableUseLocCpuidL11, "KMP_AFFINITY");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90954.303491.patch
Type: text/x-patch
Size: 584 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20201106/11e192a0/attachment-0001.bin>


More information about the Openmp-commits mailing list