diff --git generic/tclListObj.c generic/tclListObj.c
index 88a332fd3..c2b2aafea 100644
--- generic/tclListObj.c
+++ generic/tclListObj.c
@@ -1985,7 +1985,7 @@ UpdateStringOfList(
     for (i = 0; i < numElems; i++) {
 	flagPtr[i] = (i ? TCL_DONT_QUOTE_HASH : 0);
 	elem = TclGetStringFromObj(elemPtrs[i], &length);
-	bytesNeeded += TclScanElement(elem, length, flagPtr+i);
+	bytesNeeded += (unsigned int)TclScanElement(elem, length, flagPtr+i);
 	if (bytesNeeded < 0) {
 	    Tcl_Panic("max size for a Tcl value (%d bytes) exceeded", INT_MAX);
 	}
