I think is an issue with GCC's buffer overflow analysis accuracy
Found an issue for it, on GCC v12.4, I am using v13.3
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114374
I have found quite a lot of issues relating to this on StackOverflow
and elsewhere but no reference to it on the GCC mailing
Snapshot gcc-13-20250221 is now available on
https://gcc.gnu.org/pub/gcc/snapshots/13-20250221/
and on various mirrors, see https://gcc.gnu.org/mirrors.html for details.
This snapshot has been generated from the GCC 13 git branch
with the following options: git://gcc.gnu.org/git/gcc.git branch