[Openmp-commits] [PATCH] D89878: [OpenMP] Fixed a potential integer overflow
Shilei Tian via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Thu Oct 22 18:22:34 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3091ed099f2f: [OpenMP] Fixed a potential integer overflow (authored by tianshilei1992).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89878/new/
https://reviews.llvm.org/D89878
Files:
openmp/libomptarget/src/MemoryManager.cpp
Index: openmp/libomptarget/src/MemoryManager.cpp
===================================================================
--- openmp/libomptarget/src/MemoryManager.cpp
+++ openmp/libomptarget/src/MemoryManager.cpp
@@ -49,7 +49,13 @@
Num |= Num >> 4;
Num |= Num >> 8;
Num |= Num >> 16;
+#if INTPTR_MAX == INT64_MAX
Num |= Num >> 32;
+#elif INTPTR_MAX == INT32_MAX
+ // Do nothing with 32-bit
+#else
+#error Unsupported architecture
+#endif
Num += 1;
return Num >> 1;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89878.300132.patch
Type: text/x-patch
Size: 483 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20201023/4c341272/attachment.bin>
More information about the Openmp-commits
mailing list