]> granicus.if.org Git - clang/commitdiff
[analyzer] Fix a failure encountered while analyzing bind (radar://10105448).
authorAnna Zaks <ganna@apple.com>
Mon, 12 Sep 2011 18:07:30 +0000 (18:07 +0000)
committerAnna Zaks <ganna@apple.com>
Mon, 12 Sep 2011 18:07:30 +0000 (18:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139509 91177308-0d34-0410-b5e6-96231b3b80d8

lib/StaticAnalyzer/Core/BugReporterVisitors.cpp
test/Analysis/undef-buffers.c

index 9b5a60c0d6f15f3d158d925607d8861383f15613..5a56afb0566addfb80b6162ea38886871080cec8 100644 (file)
@@ -553,7 +553,7 @@ ConditionBRVisitor::VisitTrueTest(const Expr *Cond,
       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: {
index ccc55c2dee8190e3ee4a371a1d2c60cd1e8b977c..cfdd7f4e1a83fc4d40b3dd2cd69c81f7af3dd940 100644 (file)
@@ -15,6 +15,17 @@ char stackBased2 () {
   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';