Fix static analyzer regression when emitting undefined value warnings
with binary operators.  The result of a binary operator may be
undefined even if its operands are well-defined.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81874 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/GRExprEngineInternalChecks.cpp b/lib/Analysis/GRExprEngineInternalChecks.cpp
index fcc2db4..21f1465 100644
--- a/lib/Analysis/GRExprEngineInternalChecks.cpp
+++ b/lib/Analysis/GRExprEngineInternalChecks.cpp
@@ -222,25 +222,32 @@
         llvm::SmallString<256> sbuf;
         llvm::raw_svector_ostream OS(sbuf);
         const GRState *ST = N->getState();
-        const Expr *Ex;
+        const Expr *Ex = NULL; 
 
         if (ST->getSVal(B->getLHS()).isUndef()) {
           Ex = B->getLHS()->IgnoreParenCasts();
           OS << "The left operand of the '";
         }
-        else {
-          assert(ST->getSVal(B->getRHS()).isUndef());
+        else if (ST->getSVal(B->getRHS()).isUndef()) {
           Ex = B->getRHS()->IgnoreParenCasts();
           OS << "The right operand of the '";
         }
-                
-        OS << BinaryOperator::getOpcodeStr(B->getOpcode())
-           << "' expression is an undefined "
-              "or otherwise garbage value";
-        
+      
+        if (Ex) {                  
+          OS << BinaryOperator::getOpcodeStr(B->getOpcode())
+             << "' expression is an undefined "
+                "or otherwise garbage value";
+        }          
+        else {
+          // We KNOW that the result was undefined.
+          OS << "The result of the '"
+             << BinaryOperator::getOpcodeStr(B->getOpcode())
+             << "' expression is undefined";
+        }
+      
         // FIXME: Use StringRefs to pass string information.
         report = new BuiltinBugReport(*this, OS.str().str().c_str(), N);
-        report->addRange(Ex->getSourceRange());
+        if (Ex) report->addRange(Ex->getSourceRange());
       }
       else {
         report = new BuiltinBugReport(*this,