Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[analyzer] PR41335: Fix crash when no-store event is in a body-farmed…
… function. Stuffing invalid source locations (such as those in functions produced by body farms) into path diagnostics causes crashes. Fix a typo in a nearby function name. Differential Revision: https://reviews.llvm.org/D60808 llvm-svn: 358945
- Loading branch information
Showing
3 changed files
with
31 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// RUN: %clang_analyze_cc1 -w -analyzer-checker=core,debug.ExprInspection \ | ||
// RUN: -analyzer-output=text -verify %s | ||
|
||
int OSAtomicCompareAndSwapPtrBarrier(*, *, **); | ||
int OSAtomicCompareAndSwapPtrBarrier() { | ||
// There is some body in the actual header, | ||
// but we should trust our BodyFarm instead. | ||
} | ||
|
||
int *invalidSLocOnRedecl() { | ||
int *b; // expected-note{{'b' declared without an initial value}} | ||
|
||
OSAtomicCompareAndSwapPtrBarrier(0, 0, &b); // no-crash | ||
// FIXME: We don't really need these notes. | ||
// expected-note@-2{{Calling 'OSAtomicCompareAndSwapPtrBarrier'}} | ||
// expected-note@-3{{Returning from 'OSAtomicCompareAndSwapPtrBarrier'}} | ||
|
||
return b; // expected-warning{{Undefined or garbage value returned to caller}} | ||
// expected-note@-1{{Undefined or garbage value returned to caller}} | ||
} |