Collin Funk wrote: > > If I understand correctly, sprintf should return 4 here correct? And > > the buffer should have 5 NUL bytes. 4 from the arguments and 1 > > trailing, which is excluded from the return value.
Correct. I added a comment, because the situation in ISO C and POSIX has changed, not too long ago. > I have no other systems to check this on, so I will trust my findings > there. > > Reported here: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114876 Perfect! Thank you. You also found out in which corner of GCC the faulty optimization lies! Bruno