summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/exprs.c
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2011-02-23 05:11:46 +0000
committerTed Kremenek <kremenek@apple.com>2011-02-23 05:11:46 +0000
commit1a241d161948d80b3f8990ecac0806474469c5d5 (patch)
tree32747e98b9f23ec112733e72267b7a82f9146786 /clang/test/Sema/exprs.c
parentc49211c79a53926bd529bc9e74e44352131b5fdb (diff)
downloadbcm5719-llvm-1a241d161948d80b3f8990ecac0806474469c5d5.tar.gz
bcm5719-llvm-1a241d161948d80b3f8990ecac0806474469c5d5.zip
Teach CFGBuilder about null pointer constants in conditionals, and how they can be used to prune branches. Fixes false null pointer dereference warning in PR 8183.
llvm-svn: 126305
Diffstat (limited to 'clang/test/Sema/exprs.c')
-rw-r--r--clang/test/Sema/exprs.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/Sema/exprs.c b/clang/test/Sema/exprs.c
index 5917e085ea7..0d6c5488de5 100644
--- a/clang/test/Sema/exprs.c
+++ b/clang/test/Sema/exprs.c
@@ -18,6 +18,14 @@ int test_pr8876() {
return 0;
}
+// PR 8183 - Handle null pointer constants on the left-side of the '&&', and reason about
+// this when determining the reachability of the null pointer dereference on the right side.
+void pr8183(unsigned long long test)
+{
+ (void)((((void*)0)) && (*((unsigned long long*)(((void*)0))) = ((unsigned long long)((test)) % (unsigned long long)((1000000000))))); // no-warning
+ (*((unsigned long long*)(((void*)0))) = ((unsigned long long)((test)) % (unsigned long long)((1000000000)))); // expected-warning {{indirection of non-volatile null pointer will be deleted, not trap}} expected-note {{consider using __builtin_trap() or qualifying pointer with 'volatile'}}
+}
+
// PR1966
_Complex double test1() {
return __extension__ 1.0if;
OpenPOWER on IntegriCloud