summaryrefslogtreecommitdiff
path: root/test/Analysis
diff options
context:
space:
mode:
authorAnna Zaks <ganna@apple.com>2011-10-01 06:35:19 +0000
committerAnna Zaks <ganna@apple.com>2011-10-01 06:35:19 +0000
commitb459cf34c4df1a1317a9bda1e1e2cc32364e62cf (patch)
tree0ed4cc7d61a6099187badd28b6e399032cec3c56 /test/Analysis
parente82247a71a1a76e78f3b979b64d5f6412ab40266 (diff)
downloadclang-b459cf34c4df1a1317a9bda1e1e2cc32364e62cf.tar.gz
Address PR10616. The crash has already been fixed by Ted in r140725, so just refactor to use existing API + test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140932 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis')
-rw-r--r--test/Analysis/div-zero.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/Analysis/div-zero.cpp b/test/Analysis/div-zero.cpp
new file mode 100644
index 0000000000..d1261dc573
--- /dev/null
+++ b/test/Analysis/div-zero.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -analyze -analyzer-checker=core.DivideZero -verify %s
+
+int fooPR10616 (int qX ) {
+ int a, c, d;
+
+ d = (qX-1);
+ while ( d != 0 ) {
+ d = c - (c/d) * d;
+ }
+
+ return (a % (qX-1)); // expected-warning {{Division by zero}}
+
+}