[OpenMP] Fixed a potential integer overflow
authorShilei Tian <tianshilei1992@gmail.com>
Fri, 23 Oct 2020 01:21:41 +0000 (21:21 -0400)
committerShilei Tian <tianshilei1992@gmail.com>
Fri, 23 Oct 2020 01:22:19 +0000 (21:22 -0400)
commit3091ed099f2f6a3d16dbdae7d0406f54dfc3031f
treed4df4346c4a67e354ac3df055e30889cdf7d00ec
parente42f6c0ac05bae37be8e2a5fd8861773646eae1b
[OpenMP] Fixed a potential integer overflow

`size_t` has different width on 32- and 64-bit architecture, but the
computation to floor to power of two assumed it is 64-bit, which can cause an
integer overflow. In this patch, architecture detection is added so that the
operation for 64-bit `size_t`. Thank Luke for reporting the issue.

Reviewed By: jdoerfert

Differential Revision: https://reviews.llvm.org/D89878
openmp/libomptarget/src/MemoryManager.cpp