[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:40:16 PDT 2023


erichkeane added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclAttr.cpp:4484
+  if (!TooManyActiveBits) {
+    AlignVal = Alignment.getZExtValue();
+    // C++11 [dcl.align]p2:
----------------
So looking more closely, THIS is the problem right here.  I think we probably should just be storing `MaximumAlignment` and `AlignVal` as an llvm::APInt and just do the comparison on `APInt`, rather than try to be tricky with the bits here.

Basically, don't extract the 'Alignment' from the `APInt` until after the test for >.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152335/new/

https://reviews.llvm.org/D152335



More information about the cfe-commits mailing list