[PATCH] D68942: [Alignment][NFC] Move and type functions from MathExtras to Alignment
Guillaume Chatelet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 17 02:30:22 PDT 2019
gchatelet added inline comments.
================
Comment at: llvm/include/llvm/Support/Alignment.h:176
+ uintptr_t ArithAddr = reinterpret_cast<uintptr_t>(Addr);
+ assert(ArithAddr + Alignment.value() - 1 >= ArithAddr && "Overflow");
+ return alignTo(ArithAddr, Alignment);
----------------
hans wrote:
> Because Alignment.value() is a uint64_t, this won't catch overflows when addresses are 32 bits.
>
> This breaks the AlignmentDeathTest.AlignAddr test on 32-bit Windows, for example. And also here: http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/10957
>
>
> Hopefully r375090 fixes this, but maybe it would be better for Alignment::value() not to be 64-bit for example.
Thx for reporting this and for fixing it @hans.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D68942/new/
https://reviews.llvm.org/D68942
More information about the llvm-commits
mailing list