diff options
author | Ted Kremenek <kremenek@apple.com> | 2011-02-23 05:11:46 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2011-02-23 05:11:46 +0000 |
commit | c56c004e0b8030e8ca8614e7febe581221938b75 (patch) | |
tree | f7d3d64d64852d36bcaf01d6698a88d5fcfd8765 /test/Sema/exprs.c | |
parent | e7455016e5fae3db7e2d88a61633f76ab05fc9d3 (diff) | |
download | clang-c56c004e0b8030e8ca8614e7febe581221938b75.tar.gz |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126305 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/exprs.c')
-rw-r--r-- | test/Sema/exprs.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Sema/exprs.c b/test/Sema/exprs.c index 5917e085ea..0d6c5488de 100644 --- a/test/Sema/exprs.c +++ b/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; |