Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ New features

Crash and bug fixes
^^^^^^^^^^^^^^^^^^^
- Fixed a crash in the static analyzer that when the expression in an
``[[assume(expr)]]`` attribute was enclosed in parentheses. (#GH151529)

Improvements
^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ void ExprEngine::VisitAttributedStmt(const AttributedStmt *A,

for (const auto *Attr : getSpecificAttrs<CXXAssumeAttr>(A->getAttrs())) {
for (ExplodedNode *N : CheckerPreStmt) {
Visit(Attr->getAssumption(), N, EvalSet);
Visit(Attr->getAssumption()->IgnoreParens(), N, EvalSet);
}
}

Expand Down
13 changes: 13 additions & 0 deletions clang/test/Analysis/builtin_assume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,16 @@ int using_builtin_assume_has_no_sideeffects(int y) {

return y;
}

template <int ...args>
bool issue151529() {
// no-crash
[[assume((true))]];
// no-crash
[[assume(((args >= 0) && ...))]]; // expected-warning {{pack fold expression is a C++17 extension}}
return ((args >= 0) && ...); // expected-warning {{pack fold expression is a C++17 extension}}
}

void instantiate_issue151529() {
issue151529<0>();
}