diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-11-10 02:37:53 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-11-10 02:37:53 +0000 |
commit | 80bbc6d13828984633d90445ca24997450abbc9e (patch) | |
tree | 451ad5db76dda608c4bb2af9355033d993973a76 /clang/test/Analysis/ptr-arith.c | |
parent | 05671ea10af98ae128b9d7447e43b287c9e40a16 (diff) | |
download | bcm5719-llvm-80bbc6d13828984633d90445ca24997450abbc9e.tar.gz bcm5719-llvm-80bbc6d13828984633d90445ca24997450abbc9e.zip |
Refine PointerSubChecker: compare the base region instead of the original
region, so that arithmetic within a memory chunk is allowed.
llvm-svn: 86652
Diffstat (limited to 'clang/test/Analysis/ptr-arith.c')
-rw-r--r-- | clang/test/Analysis/ptr-arith.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/test/Analysis/ptr-arith.c b/clang/test/Analysis/ptr-arith.c index 3659ef33658..f77d7f5ee5a 100644 --- a/clang/test/Analysis/ptr-arith.c +++ b/clang/test/Analysis/ptr-arith.c @@ -35,6 +35,11 @@ domain_port (const char *domain_b, const char *domain_e, void f3() { int x, y; int d = &y - &x; // expected-warning{{Subtraction of two pointers that do not point to the same memory chunk may cause incorrect result.}} + + int a[10]; + int *p = &a[2]; + int *q = &a[8]; + d = q-p; // no-warning } void f4() { |