Index: lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp =================================================================== --- lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp +++ lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp @@ -1211,8 +1211,10 @@ if (!LHS || !RHS) return nullptr; - llvm::APSInt ConvertedLHS = *LHS, ConvertedRHS = *RHS; - QualType LTy = getAPSIntType(*LHS), RTy = getAPSIntType(*RHS); + llvm::APSInt ConvertedLHS, ConvertedRHS; + QualType LTy, RTy; + std::tie(ConvertedLHS, LTy) = fixAPSInt(*LHS); + std::tie(ConvertedRHS, RTy) = fixAPSInt(*RHS); doIntTypeConversion( ConvertedLHS, LTy, ConvertedRHS, RTy); return BV.evalAPSInt(BSE->getOpcode(), ConvertedLHS, ConvertedRHS); Index: test/Analysis/pr37646.c =================================================================== --- /dev/null +++ test/Analysis/pr37646.c @@ -0,0 +1,11 @@ +// REQUIRES: z3 +// RUN: %clang_analyze_cc1 -triple x86_64-apple-darwin9 -analyzer-checker=core -analyzer-store=region -analyzer-constraints=z3 -verify %s +// expected-no-diagnostics + +_Bool b; +void c() { + _Bool a = b | 0; + for (;;) + if (a) + ; +}