[PATCH] strncpy -Wstringop-truncation in bfd/
Wed Feb 21 20:44:00 GMT 2018
Several uses of strncpy in bfd/* do not compile when using -Werror in gcc 8.0.x
because of -Wstringop-truncation. A typical warning is:
../../binutils-gdb/libiberty/dyn-string.c:280:3: warning: âstrncpyâ output truncated before terminating nul copying as many bytes from a string as its length [-Wstringop-truncation]
A work-around is to use 'memcpy' instead of 'strncpy'. This spends
a few more cycles each time; but it compiles, and runs correctly
as long as the character arrays really are strings. Patch is attached.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 5789 bytes
Desc: not available
More information about the Binutils