[clang] Fix crash with align_value diagnostic reporting (PR #135013)
Erich Keane via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 9 07:15:26 PDT 2025
================
@@ -4383,7 +4383,6 @@ static void handleAlignValueAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
}
void Sema::AddAlignValueAttr(Decl *D, const AttributeCommonInfo &CI, Expr *E) {
- AlignValueAttr TmpAttr(Context, CI, E);
----------------
erichkeane wrote:
This attribute created on the stack is a smell.
I note a few have the same problem:
The following 5 functions (via manual search :/) have an attribute created on the stack:
`Sema::AddAssumeAlignedAttr`
`Sema::AddAllocAlignAttr`
`Sema::AddAlignedAttr` x2 (1 type and 1 expr implementation)
`Sema::CreateLaunchBoundsAttr`
Of these:
`Sema::AddAssumeAlignedAttr` Has the EXACT same problem (using it in a diag). So a repro should be the same
`Sema::AddAllocAlignAttr` << Same problem with diag again
`Sema::AddAlignedAttr` x2 (1 type and 1 expr implementation) << Neither seem to have this problem
`Sema::CreateLaunchBoundsAttr` << All diagnostics are in a separate file at least, so the attribute isn't out of scope immediately after `makeLaunchBoundsExpr`
I would love to have the others cleaned up, but only the 1st 2 actually have this exact issue, and should probably be cleaned up here.
https://github.com/llvm/llvm-project/pull/135013
More information about the cfe-commits
mailing list