diff --git a/clang/test/Analysis/z3-crosscheck.c b/clang/test/Analysis/z3-crosscheck.c index e0ec028c518d..13f38f43e697 100644 --- a/clang/test/Analysis/z3-crosscheck.c +++ b/clang/test/Analysis/z3-crosscheck.c @@ -77,3 +77,15 @@ void floatUnaryLNotInEq(int h, int l) { // expected-warning@-1{{garbage}} } } + +// don't crash, and also produce a core.CallAndMessage finding +void a(int); +typedef struct { + int b; +} c; +c *d; +void e() { + (void)d->b; + int f; + a(f); // expected-warning {{1st function call argument is an uninitialized value [core.CallAndMessage]}} +} diff --git a/llvm/lib/Support/Z3Solver.cpp b/llvm/lib/Support/Z3Solver.cpp index a49bedcfd2b0..eb671fe2596d 100644 --- a/llvm/lib/Support/Z3Solver.cpp +++ b/llvm/lib/Support/Z3Solver.cpp @@ -729,7 +729,7 @@ class Z3Solver : public SMTSolver { const Z3_sort Z3Sort = toZ3Sort(*getBitvectorSort(BitWidth)).Sort; // Slow path, when 64 bits are not enough. - if (LLVM_UNLIKELY(Int.getBitWidth() > 64u)) { + if (LLVM_UNLIKELY(!Int.isRepresentableByInt64())) { SmallString<40> Buffer; Int.toString(Buffer, 10); return newExprRef(Z3Expr(