gcc warnings compiling in 32-bit mode
gcc spits out a bunch of warnings similar to below for compiling for 32-bit architectures:
C:/src/tcltk/wip/tcl/generic/tclCompCmds.c: In function 'TclCompileAppendCmd':
C:/src/tcltk/wip/tcl/generic/tclCompCmds.c:144:35: warning: comparison of integer expressions of different signedness: 'Tcl_Size' {aka 'int'} and 'unsigned int' [-Wsign-compare]
144 | if (numWords == 1 || numWords > UINT_MAX) {
The comparison does not make sense on 32-bit archs as the expression will never be true. More important, the number of warnings output means potentially serious warnings are missed.
5a2d03a86eFix [1615c80638] by moving problem comparisons to common helper function check-in2026-04-30 16:04:22
I believe the version for this ticket should be 9.1. I don't think 9.0 or earlier are affected.
Those changes were introduced with [this] commit (TIP 720: Bytecode generation improvements/sanity).
Therefore, assigning to @dkf
Thanks for the pointers regarding TIP 720. I’ll try to reproduce the -Wsign-compare warnings in a true 32-bit build (either an i386 container or a multilib -m32 build). I’ll report back with the exact gcc version/flags and whether this reproduces on 9.0.2 vs current development (9.1/trunk). If confirmed, I can propose a patch to make the comparisons type-safe and verify it by rebuilding (and running relevant tests) on 32-bit.
In 9.1a1: 43 warnings like this, in: generic/tclCompCmds.c generic/tclCompCmdsGR.c generic/tclCompCmdsSZ.c
Ought to be resolved, or at least fewer error messages (max one per compiled file). Done by moving the comparison to a static inline function in tclCompile.h; if my implementation in there isn't right, fix it in that one place.
Works for me now.
Well, 9.1 build is broken now, even worse at it was:
https://github.com/tcltk/tcl/actions/runs/25206800733
Tests ended at 2026-05-01 07:53:02 UTC all.tcl: Total 481605 Passed 475243 Skipped 6295 Failed 67 Sourced 173 Test Files. Files with failing tests: compExpr.test coroutine.test dict.test info.test interp.test lmap.test mathop.test nre.test oo.test regexpComp.test stack.test trace.test
Re-opening
Failures also present on 32-bit Windows. As an aside, I'm a bit surprised GH CI does not include Windows 32-bit config.
Fixed in [5ae9991e]. Verified on mingw32, vc++ 32 and gcc 64.