Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp =================================================================== --- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -771,8 +771,9 @@ template static void fill_clamp(T &dest, U src, typename T::value_type fallback) { - dest = src <= std::numeric_limits::max() ? src - : fallback; + using UU = typename std::make_unsigned::type; + constexpr auto T_max = std::numeric_limits::max(); + dest = src >= 0 && static_cast(src) <= T_max ? src : fallback; } GDBRemoteCommunication::PacketResult