Skip to content

Can't compile on GCC 10.1 #1461

Open
@priv-kweihmann

Description

@priv-kweihmann

building on gcc 10.1 with a reasonable warning set breaks the build.
Same code on gcc 9.x builds fine

| /work/src/http/common/http_helpers.cpp:91:43: error: '%8zX' directive output may be truncated writing between 8 and 16 bytes into a region of size 9 [-Werror=format-truncation=]
| 91 | snprintf(buffer, sizeof(buffer), "%8zX", bytes_read);
| | ^~~~
| /work/src/http/common/http_helpers.cpp:91:42: note: directive argument in the range [1, 18446744073709551615]
| 91 | snprintf(buffer, sizeof(buffer), "%8zX", bytes_read);
| | ^~~~~~
| In file included from /include/usr/include/stdio.h:867,
| from /include/usr/include/c++/10.1.0/cstdio:42,
| from /include/usr/include/c++/10.1.0/ext/string_conversions.h:43,
| from /include/usr/include/c++/10.1.0/bits/basic_string.h:6535,
| from /include/usr/include/c++/10.1.0/string:55,
| from /work/src/pch/stdafx.h:52,
| from /work/src/http/common/http_helpers.cpp:14:
| /include/usr/include/bits/stdio2.h:67:35: note: '__builtin___snprintf_chk' output between 9 and 17 bytes into a destination of size 9
| 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
| | ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 68 | __bos (__s), __fmt, __va_arg_pack ());
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| cc1plus: all warnings being treated as errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions