[Bugs] [Bug 1492847] core (named threads): flood of -Wformat-truncation warnings with gcc-7.

bugzilla at redhat.com bugzilla at redhat.com
Mon Jul 23 03:01:40 UTC 2018


https://bugzilla.redhat.com/show_bug.cgi?id=1492847

Worker Ant <bugzilla-bot at gluster.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|POST                        |MODIFIED



--- Comment #8 from Worker Ant <bugzilla-bot at gluster.org> ---
COMMIT: https://review.gluster.org/18287 committed in master by "Amar Tumballi"
<amarts at redhat.com> with a commit message- core (named threads): flood of
-Wformat-truncation warnings with gcc-7.1

Starting in Fedora 26 which has gcc-7.1.x, -Wformat-trunction is enabled
with -Wformat, resulting in a flood of new warnings. This many warnings
is a concern because it makes it hard(er) to see other warnings that
should be addressed.

An example is at
https://kojipkgs.fedoraproject.org//packages/glusterfs/3.12.0/1.fc28/data/logs/x86_64/build.log

For more info see https://review.gluster.org/#/c/18267/

I can't find much (or good) documentation on the heuristics the
compiler uses for this warning. In the case of printing integer types
it appears it looks at the available space in the destination and the
range of values for the variable and/or its type.

To address the specific question about why 0x3ff versus 0xfff to mask
the value, either would suffice to hint to the compiler that the
printed value will fit in three characters. But the loop is from
0...1023 (or 0...0x3ff if you prefer) so I chose that as a more
"accurate" mask to use as it exactly matches the range of values of
the loop.

Fixes: bz#1492847
Change-Id: I6e309ba42159841131d8241bfc0566ef09e00aa9

-- 
You are receiving this mail because:
You are on the CC list for the bug.
You are the assignee for the bug.


More information about the Bugs mailing list