summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/undef-call.c
diff options
context:
space:
mode:
authorGabor Horvath <xazax.hun@gmail.com>2018-04-13 12:36:08 +0000
committerGabor Horvath <xazax.hun@gmail.com>2018-04-13 12:36:08 +0000
commitca7923ab004fe649b803925113b0421f37bfed42 (patch)
treef87c102fa173bf420b729179d2fc2e16a983adc6 /clang/test/Analysis/undef-call.c
parente1ae337cd50b2a6b553b55544e7c81dca74e1dab (diff)
downloadbcm5719-llvm-ca7923ab004fe649b803925113b0421f37bfed42.tar.gz
bcm5719-llvm-ca7923ab004fe649b803925113b0421f37bfed42.zip
[analyzer] Fix null deref in AnyFunctionCall::getRuntimeDefinition
Patch by: Rafael Stahl! Differential Revision: https://reviews.llvm.org/D45564 llvm-svn: 330009
Diffstat (limited to 'clang/test/Analysis/undef-call.c')
-rw-r--r--clang/test/Analysis/undef-call.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/Analysis/undef-call.c b/clang/test/Analysis/undef-call.c
new file mode 100644
index 00000000000..35c0b685ce7
--- /dev/null
+++ b/clang/test/Analysis/undef-call.c
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -fsyntax-only -analyze -analyzer-checker=debug.ExprInspection -analyzer-config experimental-enable-naive-ctu-analysis=true -analyzer-config ctu-dir=%T/ctudir -verify %s
+// expected-no-diagnostics
+
+struct S {
+ void (*fp)();
+};
+
+int main() {
+ struct S s;
+ // This will cause the analyzer to look for a function definition that has
+ // no FunctionDecl. It used to cause a crash in AnyFunctionCall::getRuntimeDefinition.
+ // It would only occur when CTU analysis is enabled.
+ s.fp();
+}
OpenPOWER on IntegriCloud