https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104012
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |msebor at gcc dot gnu.org --- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> --- I'm not able to reproduce a warning for the test case in attachment 52182 with the top of GCC trunk configured for x86_64 at -O2 or -O3 and with -m32. There are three calls to snprintf() in CreateMakeVariable() and for each call GCC determines the output of the %04d directive is exactly four bytes (see the dump produced by -ftree-dump-strlen): /home/buildbot/repos/CMake/Source/cmLocalUnixMakefileGenerator3.cxx:1307: snprintf: objsize = 5, fmtstr = "%04d" Directive 1 at offset 0: "%04d" Result: 4, 4, 4, 4 (4, 4, 4, 4) Directive 2 at offset 4: "", length = 1 Substituting 4 for return value. /home/buildbot/repos/CMake/Source/cmLocalUnixMakefileGenerator3.cxx:1311: snprintf: objsize = 5, fmtstr = "%04d" Directive 1 at offset 0: "%04d" Result: 4, 4, 4, 4 (4, 4, 4, 4) Directive 2 at offset 4: "", length = 1 Substituting 4 for return value. /home/buildbot/repos/CMake/Source/cmLocalUnixMakefileGenerator3.cxx:1282: snprintf: objsize = 5, fmtstr = "%04d" Directive 1 at offset 0: "%04d" Result: 4, 4, 4, 4 (4, 4, 4, 4) Directive 2 at offset 4: "", length = 1 Substituting 4 for return value. If you see the warning with the latest GCC 12 please provide the full command line (see https://gcc.gnu.org/bugs/#need for a detailed list of what we ask users to provide in order to reproduce issues).