[PATCH] D152335: [Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range

2023-06-08 Thread Shafik Yaghmour via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG086183c6c65f: [Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of… (authored by shafik). Herald added a project: clang. Ch

[PATCH] D152335: [Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range

2023-06-08 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik updated this revision to Diff 529714. shafik added a comment. - Add release note CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152335/new/ https://reviews.llvm.org/D152335 Files: clang/docs/ReleaseNotes.rst clang/lib/Sema/SemaDeclAttr.cpp clang/test/Sema/attr-aligned.c I

[PATCH] D152335: [Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range

2023-06-07 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. In D152335#4404118 , @aaron.ballman wrote: > LGTM with a release note. > > In D152335#4404114 , @erichkeane > wrote: > >> Needs a release note. Also, the changing of order is POSSIBL

[PATCH] D152335: [Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range

2023-06-07 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman accepted this revision. aaron.ballman added a comment. LGTM with a release note. In D152335#4404114 , @erichkeane wrote: > Needs a release note. Also, the changing of order is POSSIBLY a change in > behavior (in that we're now diagnosing

[PATCH] D152335: [Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range

2023-06-07 Thread Erich Keane via Phabricator via cfe-commits
erichkeane accepted this revision. erichkeane added a comment. This revision is now accepted and ready to land. Needs a release note. Also, the changing of order is POSSIBLY a change in behavior (in that we're now diagnosing 'out of range' before 'power of 2'), but I don't think we care. CHAN

[PATCH] D152335: [Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range

2023-06-07 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik marked an inline comment as done. shafik added inline comments. Comment at: clang/test/Sema/attr-aligned.c:1 -// RUN: %clang_cc1 -triple i386-apple-darwin9 -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -verify %s

[PATCH] D152335: [Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range

2023-06-07 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik updated this revision to Diff 529396. shafik marked 2 inline comments as done. shafik added a comment. - Switched to using APSInt::operator> as discussed offline w/ Erich and Aaron CHANGES SINCE LAST ACTION https://reviews.llvm.org/D152335/new/ https://reviews.llvm.org/D152335 Files:

[PATCH] D152335: [Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range

2023-06-07 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman added inline comments. Comment at: clang/lib/Sema/SemaDeclAttr.cpp:4484 + if (!TooManyActiveBits) { +AlignVal = Alignment.getZExtValue(); +// C++11 [dcl.align]p2: erichkeane wrote: > So looking more closely, THIS is the problem right here.

[PATCH] D152335: [Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range

2023-06-07 Thread Erich Keane via Phabricator via cfe-commits
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 s

[PATCH] D152335: [Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range

2023-06-07 Thread Erich Keane via Phabricator via cfe-commits
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).

[PATCH] D152335: [Clang] Add check to Sema::AddAlignedAttr to verify active bits is not out of range

2023-06-06 Thread Shafik Yaghmour via Phabricator via cfe-commits
shafik created this revision. shafik added reviewers: aaron.ballman, erichkeane. Herald added a project: All. shafik requested review of this revision. If we provide too large a value for the alignment attribute `APInt::getZExtValue()` will assert. This PR adds a active bits check and folds it i