Index: lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp =================================================================== --- lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp +++ lib/StaticAnalyzer/Core/Z3ConstraintManager.cpp @@ -1231,8 +1231,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 BVF.evalAPSInt(BSE->getOpcode(), ConvertedLHS, ConvertedRHS); Index: test/Analysis/apsint.c =================================================================== --- test/Analysis/apsint.c +++ test/Analysis/apsint.c @@ -1,7 +0,0 @@ -// REQUIRES: z3 -// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux-gnu -analyzer-checker=core -verify %s -// expected-no-diagnostics - -_Bool a() { - return !({ a(); }); -} Index: test/Analysis/z3/apsint.c =================================================================== --- test/Analysis/z3/apsint.c +++ test/Analysis/z3/apsint.c @@ -0,0 +1,16 @@ +// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux-gnu -analyzer-checker=core -verify %s +// expected-no-diagnostics + +// https://bugs.llvm.org/show_bug.cgi?id=37622 +_Bool a() { + return !({ a(); }); +} + +// https://bugs.llvm.org/show_bug.cgi?id=37646 +_Bool b; +void c() { + _Bool a = b | 0; + for (;;) + if (a) + ; +}