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

            Bug ID: 117846
           Summary: [15 Regression] go-encode-id.cc:176:48: error: ‘%02x’
                    directive output may be truncated writing between 2
                    and 8 bytes into a region of size 6
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hjl.tools at gmail dot com
  Target Milestone: ---

When Go is enabled, r15-5775-g5a6af707f0af0a gave me:

/export/gnu/import/git/sources/gcc/gcc/go/gofrontend/go-encode-id.cc: In
function ‘std::string go_encode_id(const std::string&)’:
/export/gnu/import/git/sources/gcc/gcc/go/gofrontend/go-encode-id.cc:176:48:
error: ‘%02x’ directive output may be truncated writing between 2 and 8 bytes
into a region of size 6 [-Werror=format-truncation=]
  176 |                   snprintf(buf, sizeof buf, "_x%02x", c);
      |                                                ^~~~
/export/gnu/import/git/sources/gcc/gcc/go/gofrontend/go-encode-id.cc:176:45:
note: directive argument in the range [128, 4294967295]
  176 |                   snprintf(buf, sizeof buf, "_x%02x", c);
      |                                             ^~~~~~~~
/export/gnu/import/git/sources/gcc/gcc/go/gofrontend/go-encode-id.cc:176:27:
note: ‘snprintf’ output between 5 and 11 bytes into a destination of size 8
  176 |                   snprintf(buf, sizeof buf, "_x%02x", c);
      |                   ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to