[PATCH] D152335: [Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jun 7 06:28:13 PDT 2023
erichkeane added inline comments.
================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:4480
MaximumAlignment = std::min(MaximumAlignment, uint64_t(8192));
- if (AlignVal > MaximumAlignment) {
+ bool TooManyActiveBits = Alignment.getActiveBits() > llvm::APInt(64, MaximumAlignment).getActiveBits();
+
----------------
What is the purpose of using 'ActiveBits' here? Why is this not a sub-set of the operator `>` from below? That is, 'ActiveBits' allows for 0xFF when the 'MaxValue' is 0x80 (top bit set), but the operator > would have caught that anyway, right?
Also, how does 'ActiveBits' work with negative numbers?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D152335/new/
https://reviews.llvm.org/D152335
More information about the cfe-commits
mailing list