Index: lib/StaticAnalyzer/Core/SVals.cpp =================================================================== --- lib/StaticAnalyzer/Core/SVals.cpp +++ lib/StaticAnalyzer/Core/SVals.cpp @@ -301,12 +301,21 @@ switch (getSubKind()) { case nonloc::ConcreteIntKind: { const nonloc::ConcreteInt& C = castAs(); - if (C.getValue().isUnsigned()) - os << C.getValue().getZExtValue(); - else - os << C.getValue().getSExtValue(); - os << ' ' << (C.getValue().isUnsigned() ? 'U' : 'S') - << C.getValue().getBitWidth() << 'b'; + bool IsSigned = C.getValue().isSigned(); + // FIXME: We can just call C.getValue().print() for all cases, but it has + // rather slow performance (see implementation of toString()). + // Let's call it only for integer values > 64 bits. + if (C.getValue().getBitWidth() <= llvm::APInt::APINT_BITS_PER_WORD) { + // NOTE: don't use ternary here! Otherwise, unsigned value will be + // always printed due to implicit type conversion. + if (IsSigned) + os << C.getValue().getSExtValue(); + else + os << C.getValue().getZExtValue(); + } else { + C.getValue().print(os, IsSigned); + } + os << ' ' << (IsSigned ? 'S' : 'U') << C.getValue().getBitWidth() << 'b'; break; } case nonloc::SymbolValKind: Index: test/Analysis/egraph-dump-int128.c =================================================================== --- /dev/null +++ test/Analysis/egraph-dump-int128.c @@ -0,0 +1,7 @@ +// RUN: rm -fR %t.dir +// RUN: mkdir -p %t.dir +// RUN: env TMPDIR=%t.dir TEMP=%t.dir TMP=%t.dir %clang_analyze_cc1 -analyzer-checker=debug.ViewExplodedGraph %s + +unsigned __int128 get_big_value() { + return (unsigned __int128)5 << 64; // Do not crash +}