[cfe-commits] r140932 - in /cfe/trunk: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp test/Analysis/div-zero.cpp
Anna Zaks
ganna at apple.com
Fri Sep 30 23:35:19 PDT 2011
Author: zaks
Date: Sat Oct 1 01:35:19 2011
New Revision: 140932
URL: http://llvm.org/viewvc/llvm-project?rev=140932&view=rev
Log:
Address PR10616. The crash has already been fixed by Ted in r140725, so just refactor to use existing API + test case.
Added:
cfe/trunk/test/Analysis/div-zero.cpp
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp?rev=140932&r1=140931&r2=140932&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Sat Oct 1 01:35:19 2011
@@ -315,7 +315,7 @@
if (ps->getStmt() == S)
break;
}
- N = N->pred_empty() ? 0 : *N->pred_begin();
+ N = N->getFirstPred();
}
if (!N)
Added: cfe/trunk/test/Analysis/div-zero.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/div-zero.cpp?rev=140932&view=auto
==============================================================================
--- cfe/trunk/test/Analysis/div-zero.cpp (added)
+++ cfe/trunk/test/Analysis/div-zero.cpp Sat Oct 1 01:35:19 2011
@@ -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}}
+
+}
More information about the cfe-commits
mailing list