https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125187
--- Comment #7 from Oliver Schönrock <oschonrock at gmail dot com> --- after reading the related bug report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116515 I tried compiling with the fmt-header-only target, which reduces the problem to a single TU. The warning is very similar.. ``` [ 50%] Building CXX object CMakeFiles/ub.dir/ub.cpp.o /usr/bin/g++ -DFMT_HEADER_ONLY=1 -I/home/oliver/Projects/ub/build/_deps/fmt-src/include -O3 -DNDEBUG -std=gnu++26 -flto=auto -fno-fat-lto-objects -save-temps -MD -MT CMakeFiles/ub.dir/ub.cpp.o -MF CMakeFiles/ub.dir/ub.cpp.o.d -o CMakeFiles/ub.dir/ub.cpp.o -c /home/oliver/Projects/ub/ub.cpp [100%] Linking CXX executable ub /usr/bin/cmake -E cmake_link_script CMakeFiles/ub.dir/link.txt --verbose=1 /usr/bin/g++ -O3 -DNDEBUG -flto=auto -fno-fat-lto-objects -Wl,--dependency-file=CMakeFiles/ub.dir/link.d CMakeFiles/ub.dir/ub.cpp.o -o ub In function ‘write2digits’, inlined from ‘write_significand’ at /home/oliver/Projects/ub/build/_deps/fmt-src/include/fmt/format.h:2415:17, inlined from ‘write_significand’ at /home/oliver/Projects/ub/build/_deps/fmt-src/include/fmt/format.h:2407:13, inlined from ‘write_significand’ at /home/oliver/Projects/ub/build/_deps/fmt-src/include/fmt/format.h:2434:31, inlined from ‘write_significand’ at /home/oliver/Projects/ub/build/_deps/fmt-src/include/fmt/format.h:2461:20, inlined from ‘operator()’ at /home/oliver/Projects/ub/build/_deps/fmt-src/include/fmt/format.h:2539:33, inlined from ‘write_padded’ at /home/oliver/Projects/ub/build/_deps/fmt-src/include/fmt/format.h:1701:9, inlined from ‘write_padded’ at /home/oliver/Projects/ub/build/_deps/fmt-src/include/fmt/format.h:1710:43, inlined from ‘write_fixed’ at /home/oliver/Projects/ub/build/_deps/fmt-src/include/fmt/format.h:2536:44: /home/oliver/Projects/ub/build/_deps/fmt-src/include/fmt/format.h:1209:11: warning: writing 2 bytes into a region of size 0 -Wstringop-overflow=] 1209 | memcpy(out, digits2(value), 2); | ^ /home/oliver/Projects/ub/build/_deps/fmt-src/include/fmt/format.h: In function ‘write_fixed’: /home/oliver/Projects/ub/build/_deps/fmt-src/include/fmt/format.h:2433:8: note: at offset [-11, -1] into destination object buffer’ of size 11 2433 | Char buffer[digits10<UInt>() + 2]; | ^ ``` Curiously, to me at least, despite this being a single TU, the warning still ONLY occurs when LTO is enabled. I would have thought that there is no LTO to do in a single TU link stage? I will now attach the single TU preprocessed source (which was never provided in the related 116515).
