Attachment "36bcf04a70.diff" to
ticket [36bcf04a70]
added by
chrstphrchvz
2023-08-10 11:44:58.
diff --git generic/tclInt.h generic/tclInt.h
index 00dafc6d3e..31fb11620c 100644
--- generic/tclInt.h
+++ generic/tclInt.h
@@ -4362,7 +4362,17 @@ MODULE_SCOPE int TclCommandWordLimitError(Tcl_Interp *interp, Tcl_Size count);
*/
static inline int TclGetSizeIntFromObj(Tcl_Interp *interp, Tcl_Obj *objPtr, Tcl_Size *sizePtr) {
#if TCL_SIZE_MAX == INT_MAX
- return TclGetIntFromObj(interp, objPtr, sizePtr);
+ /*
+ * Bug 36bcf04a70: use this approach rather than
+ * return TclGetIntFromObj(interp, objPtr, sizePtr);
+ * to avoid incompatible pointer warnings when Tcl_Size is not int.
+ */
+ int i;
+ if (TclGetIntFromObj(interp, objPtr, &i) != TCL_OK) {
+ return TCL_ERROR;
+ }
+ *sizePtr = i;
+ return TCL_OK;
#else
Tcl_WideInt wide;
if (TclGetWideIntFromObj(interp, objPtr, &wide) != TCL_OK) {