aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorZhongxing Xu <xuzhongxing@gmail.com>2009-11-09 05:34:10 +0000
committerZhongxing Xu <xuzhongxing@gmail.com>2009-11-09 05:34:10 +0000
commit3ce2dc358ea951c384fa27bcf2ba4a222c2c0511 (patch)
treea3f2e24aa672ae6e2723a66e88cb65e95ef41439 /test
parent654ad40f27d684e8f3eddbc990247a6dbea5dded (diff)
Add checker for CWE-469: Use of Pointer Subtraction to Determine Size. This
checker does not build sink nodes. Because svaluator computes an unknown value for the subtraction now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86517 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Analysis/ptr-arith.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/Analysis/ptr-arith.c b/test/Analysis/ptr-arith.c
index d08d7e9471..fc404e282e 100644
--- a/test/Analysis/ptr-arith.c
+++ b/test/Analysis/ptr-arith.c
@@ -31,3 +31,8 @@ domain_port (const char *domain_b, const char *domain_e,
port = 10 * port + (*p - '0');
return port;
}
+
+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.}}
+}