[clang] Avoid printing overly large integer. (PR #75902)

Botond István Horváth via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 19 08:45:07 PST 2023


================
@@ -17132,6 +17132,9 @@ static bool ConvertAPValueToString(const APValue &V, QualType T,
         case BuiltinType::WChar_U: {
           unsigned TyWidth = Context.getIntWidth(T);
           assert(8 <= TyWidth && TyWidth <= 32 && "Unexpected integer width");
+          if (V.getInt() >= (1 << 64)) {
----------------
HoBoIs wrote:

In 1 << 64 you operates with ints(32 bit). (1 is an int) 1<<64 is results 0. I suggest to compare V.getInt() with std::numeric_limits\<uint64_t\>::max()} instead. (or uint64_t(-1)).

https://github.com/llvm/llvm-project/pull/75902


More information about the cfe-commits mailing list