https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101451

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-08-11
             Status|UNCONFIRMED                 |WAITING
     Ever confirmed|0                           |1

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The warning in the attached testcase is correct.  strncat if truncated does not
put a null character.
The reason why you only get the warning once is because GCC decided the
functions are the same. If you swap the order of good and bad in the source you
will get a warning for the good function.

If you add:
dest[sizeof(dest) - 1] = 0;
After the strncat, the warning goes away.


strncat in this case will only do "sizeof(dest) - 1" in copying and will not
copy the null character.

>However, I cannot produce a simple test case to reproduce it.
Do you have a full testcase that you can share, we will try to reduce it and
see why it is still failing.

Reply via email to