diff --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h --- a/llvm/include/llvm/Demangle/ItaniumDemangle.h +++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h @@ -2330,17 +2330,14 @@ template void match(Fn F) const { F(Contents); } void printLeft(OutputBuffer &OB) const override { - const char *first = &*Contents.begin(); - const char *last = &*Contents.end() + 1; - const size_t N = FloatData::mangled_size; - if (static_cast(last - first) > N) { - last = first + N; + if (Contents.size() >= N) { union { Float value; char buf[sizeof(Float)]; }; - const char *t = first; + const char *t = &*Contents.begin(); + const char *last = t + N; char *e = buf; for (; t != last; ++t, ++e) { unsigned d1 = isdigit(*t) ? static_cast(*t - '0')