From b459cf34c4df1a1317a9bda1e1e2cc32364e62cf Mon Sep 17 00:00:00 2001 From: Anna Zaks Date: Sat, 1 Oct 2011 06:35:19 +0000 Subject: 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 --- test/Analysis/div-zero.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 test/Analysis/div-zero.cpp (limited to 'test/Analysis') 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}} + +} -- cgit v1.2.1