> From: Bruno Haible <[email protected]> > Cc: [email protected], [email protected], [email protected] > Date: Tue, 20 Aug 2019 23:09:05 +0200 > > > > > install-info.c: In function 'split_entry': > > > > install-info.c:1624:17: warning: 'strncat' specified bound 2 > > > > equals source length [-Wstringop-overflow=] > > > > strncat (*description, " ", 2); > > > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > > > > > > The warnings are clearly pointless, because the amount of memory > > > allocated for *description is unknown to the compiler. > > > > > > Which GCC options did you specify? > > > > I didn't specify any options, the options in effect were those that > > the Texinfo build system specifies. > > Strange. On a glibc system, I get different results: > > * With gcc 8.3.0, no warnings in install-info.c. > > * With gcc 9.2.0, just one warning: > > In file included from /usr/include/string.h:630, > from ../gnulib/lib/string.h:41, > from ../../system.h:34, > from ../../install-info/install-info.c:18: > ../../install-info/install-info.c: In function 'split_entry.constprop': > ../../install-info/install-info.c:1634:11: warning: '__builtin_strncat' > output truncated before terminating nul copying as many bytes from a string > as its length [-Wstringop-truncation] > 1634 | strncat (*description, ptr, length); > | ^~~~~~~ > ../../install-info/install-info.c:1633:27: note: length computed here > 1633 | size_t length = strlen (ptr); > | ^~~~~~~~~~~~
My GCC version is 8.2.0. Also, did your compilation use -O2 (that should be the default, AFAIU)? I think these warnings mostly require the optimization pass to be emitted. One other thought is to disable builtin strncat, and see if that matters.
