[GOLD] gcc-11 stringop-overflow warning
authorAlan Modra <amodra@gmail.com>
Mon, 7 Dec 2020 06:46:46 +0000 (17:16 +1030)
committerAlan Modra <amodra@gmail.com>
Mon, 7 Dec 2020 12:06:22 +0000 (22:36 +1030)
commitcd8d2039b01382a49054f2e3e0c9196e2dba5c0c
treedb1a14c6fd96b8b38799acf66f970e6ad20132f2
parentfde0214a915dc09743006022df2365f8e9ea3eed
[GOLD] gcc-11 stringop-overflow warning

I'm unsure why this is deserving of a warning.  Not writing the most
efficient code surely can't be a real problem, but that is what
https://gcc.gnu.org/bugzilla//show_bug.cgi?id=88059#c1 seems to say.

plugin.cc:528:10: error: 'char* strncpy(char*, const char*, size_t)' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
  528 |   strncpy(tempdir, dir_template, len);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
plugin.cc:526:22: note: length computed here
  526 |   size_t len = strlen(dir_template) + 1;
      |                ~~~~~~^~~~~~~~~~~~~~

* plugin.cc (Plugin_recorder::init): Replace strncpy with memcpy.
gold/ChangeLog
gold/plugin.cc
This page took 0.024727 seconds and 4 git commands to generate.