Skip to content

[clang][analyzer] Fix a crash in alpha.unix.BlockInCriticalSection #90030

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 15, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,8 @@ class RAIIMutexDescriptor {
// this function is called instead of early returning it. To avoid this, a
// bool variable (IdentifierInfoInitialized) is used and the function will
// be run only once.
Guard = &Call.getCalleeAnalysisDeclContext()->getASTContext().Idents.get(
GuardName);
IdentifierInfoInitialized = true;
const auto &ASTCtx = Call.getState()->getStateManager().getContext();
Guard = &ASTCtx.Idents.get(GuardName);
}
}

Expand Down
6 changes: 6 additions & 0 deletions clang/test/Analysis/block-in-critical-section.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// RUN: %clang_analyze_cc1 -analyzer-checker=core,alpha.unix.BlockInCriticalSection -verify %s
// expected-no-diagnostics

// This should not crash
int (*a)(void);
void b(void) { a(); }
Loading