[llvm] r375090 - Try to fix the assert in Alignment::alignAddr to work on 32-bit

Hans Wennborg via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 17 02:01:39 PDT 2019


Author: hans
Date: Thu Oct 17 02:01:39 2019
New Revision: 375090

URL: http://llvm.org/viewvc/llvm-project?rev=375090&view=rev
Log:
Try to fix the assert in Alignment::alignAddr to work on 32-bit

Hopefully fixing the AlignmentDeathTest.AlignAddr failures (e.g. at
http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/10925)

Modified:
    llvm/trunk/include/llvm/Support/Alignment.h

Modified: llvm/trunk/include/llvm/Support/Alignment.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Alignment.h?rev=375090&r1=375089&r2=375090&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Alignment.h (original)
+++ llvm/trunk/include/llvm/Support/Alignment.h Thu Oct 17 02:01:39 2019
@@ -183,7 +183,8 @@ inline uint64_t alignTo(uint64_t Size, M
 /// Aligns `Addr` to `Alignment` bytes, rounding up.
 inline uintptr_t alignAddr(const void *Addr, Align Alignment) {
   uintptr_t ArithAddr = reinterpret_cast<uintptr_t>(Addr);
-  assert(ArithAddr + Alignment.value() - 1 >= ArithAddr && "Overflow");
+  assert(static_cast<uintptr_t>(ArithAddr + Alignment.value() - 1) >=
+             ArithAddr && "Overflow");
   return alignTo(ArithAddr, Alignment);
 }
 




More information about the llvm-commits mailing list