[cfe-commits] r139509 - in /cfe/trunk: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp test/Analysis/undef-buffers.c
Anna Zaks
ganna at apple.com
Mon Sep 12 11:07:30 PDT 2011
Author: zaks
Date: Mon Sep 12 13:07:30 2011
New Revision: 139509
URL: http://llvm.org/viewvc/llvm-project?rev=139509&view=rev
Log:
[analyzer] Fix a failure encountered while analyzing bind (radar://10105448).
Modified:
cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
cfe/trunk/test/Analysis/undef-buffers.c
Modified: cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp?rev=139509&r1=139508&r2=139509&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp Mon Sep 12 13:07:30 2011
@@ -553,7 +553,7 @@
default:
return 0;
case Stmt::BinaryOperatorClass:
- return VisitTrueTest(Cond, cast<BinaryOperator>(Cond), tookTrue, BRC);
+ return VisitTrueTest(Cond, cast<BinaryOperator>(Ex), tookTrue, BRC);
case Stmt::DeclRefExprClass:
return VisitTrueTest(Cond, cast<DeclRefExpr>(Ex), tookTrue, BRC);
case Stmt::UnaryOperatorClass: {
Modified: cfe/trunk/test/Analysis/undef-buffers.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Analysis/undef-buffers.c?rev=139509&r1=139508&r2=139509&view=diff
==============================================================================
--- cfe/trunk/test/Analysis/undef-buffers.c (original)
+++ cfe/trunk/test/Analysis/undef-buffers.c Mon Sep 12 13:07:30 2011
@@ -15,6 +15,17 @@
return buf[0]; // expected-warning{{Undefined}}
}
+// Exercise the conditional visitor. Radar://10105448
+char stackBased3 (int *x) {
+ char buf[2];
+ int *y;
+ buf[0] = 'a';
+ if (!(y = x)) {
+ return buf[1]; // expected-warning{{Undefined}}
+ }
+ return buf[0];
+}
+
char heapBased1 () {
char *buf = malloc(2);
buf[0] = 'a';
More information about the cfe-commits
mailing list