diff options
| author | Artem Dergachev <artem.dergachev@gmail.com> | 2019-04-23 02:50:38 +0000 |
|---|---|---|
| committer | Artem Dergachev <artem.dergachev@gmail.com> | 2019-04-23 02:50:38 +0000 |
| commit | e2a8e43160588e12923994e2b44f67b2a7443a95 (patch) | |
| tree | b4cd0fb2b5a92c961cf9648cc8eebe6db5979006 /clang/test | |
| parent | 8c6119a44275852b868c6df0c14ee85efeb2a9e5 (diff) | |
| download | bcm5719-llvm-e2a8e43160588e12923994e2b44f67b2a7443a95.tar.gz bcm5719-llvm-e2a8e43160588e12923994e2b44f67b2a7443a95.zip | |
[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
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/Analysis/OSAtomic_mac.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/Analysis/OSAtomic_mac.c b/clang/test/Analysis/OSAtomic_mac.c new file mode 100644 index 00000000000..a69d98078e1 --- /dev/null +++ b/clang/test/Analysis/OSAtomic_mac.c @@ -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}} +} |

