Re: gcc trunk fails to build kernel on PowerPC64 due to oprofile warnings

From: Arnd Bergmann
Date: Thu Jan 26 2017 - 07:57:25 EST

On Thu, Jan 26, 2017 at 12:00 PM, David Laight <David.Laight@xxxxxxxxxx> wrote:
> From: Anton Blanchard
>> Sent: 25 January 2017 23:01
>> gcc trunk has failed to build PowerPC64 kernels for a month or so. The issue
>> is in oprofile, which is common code but ends up being sucked into
>> arch/powerpc and therefore subject to the -Werror applied to arch/powerpc:
> ...
>> linux/arch/powerpc/oprofile/../../../drivers/oprofile/oprofile_stats.c:55:25: error: %d directive
>> output may be truncated writing between 1 and 11 bytes into a region of size 7 [-Werror=format-
>> truncation=]
>> snprintf(buf, 10, "cpu%d", i);
> FFS these warnings are getting OTT.
> The compiler needs to be able to track the domain of integers before applying
> some of these warnings.

gcc-7 introduces lots of new warnings, some better than others. I'm
trying to categorize
both the new warnings and any others added in the recent years that we
may have missed
to see whether we want to turn them on by default or only in
when building with W=1, W=2 or W=3.

I made a spreadsheet with the warnings that we have available in each version,
and also the number of unique output lines for that warning, see

For this specific warning, an ARM allmodconfig build shows 360
distinct warnings from a
total of 243 files. It's probably a good idea to look over them once
to see if anything sticks
out, but otherwise I think we change it to the W=2 level.