https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96367
Bug ID: 96367
Summary: bogus format truncation error on armhf when building
perf with gcc 10
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: andrea.righi at canonical dot com
Target Milestone: ---
After moving to gcc-10 (in Ubuntu Groovy) we're getting an error during the
perf build (only on the armhf architecture) when compiling the Linux kernel:
util/map.c:124:5: error: ā%sā directive output may be truncated writing
between 1 and 2147483645 bytes into a region of size 4096
[-Werror=format-truncation=]
Source code:
https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/groovy/tree/tools/perf/util/map.c?h=master-next#n117
Looking at the source code it seems to be a false positive: the snprintf()
should never exceed the size of 4096 as reported by the error (the new length
is checked immediately before calling snprintf).
Moreover, it is quite strange that we are getting this error only on armhf. At
least I'm expecting to get this error across all architectures and not just
armhf.
Do you think it's a bug or am I missing something obvious? Thanks!