gcc-9.2.0 and spurious warnings

Josef Wolf jw@raven.inka.de
Fri Dec 13 07:10:00 GMT 2019

Thanks for the help, Jeff!

On Thu, Dec 12, 2019 at 01:41:08PM -0700, Jeff Law wrote:
> I believe it's telling you that the supplied length is zero and that
> you haven't changed the destination string.  For that to be true, q
> must have the same value as p.  I suspect most of the time a zero
> length parameter to strncpy is unintentional.

I agree that strncpy() CAN be called with length==0. But this can happen only
when get_word() is passed an empty string.

Is it really evil to deal with empty strings? =8-O

Josef Wolf

More information about the Gcc-help mailing list