Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1639655
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] xfs: avoid harmless gcc-7 warnings |
| Date | 2017-05-11 17:00 +0200 |
| Message-ID | <tFXJn-7DY-21@gated-at.bofh.it> (permalink) |
| References | <tFVHz-6lJ-1@gated-at.bofh.it> <tFXJn-7DY-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, May 11, 2017 at 4:02 PM, Christoph Hellwig <hch@infradead.org> wrote:
> On Thu, May 11, 2017 at 02:49:21PM +0200, Arnd Bergmann wrote:
>> gcc-7 flags the use of integer math inside of a condition
>> as a potential bug:
>>
>> fs/xfs/xfs_bmap_util.c: In function 'xfs_swap_extents_check_format':
>> fs/xfs/xfs_bmap_util.c:1619:8: error: '<<' in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
>> fs/xfs/xfs_bmap_util.c:1629:8: error: '<<' in boolean context, did you mean '<' ? [-Werror=int-in-bool-context]
>>
>> This one is clearly fine, and we can add a comparison to zero
>> to shut up the warning.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> fs/xfs/xfs_bmap_util.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
>> index 2b954308a1d6..cbd3ffe42f39 100644
>> --- a/fs/xfs/xfs_bmap_util.c
>> +++ b/fs/xfs/xfs_bmap_util.c
>> @@ -1613,7 +1613,7 @@ xfs_swap_extents_check_format(
>> * extent format...
>> */
>> if (tip->i_d.di_format == XFS_DINODE_FMT_BTREE) {
>> - if (XFS_IFORK_BOFF(ip) &&
>> + if ((XFS_IFORK_BOFF(ip) != 0) &&
>
> Even if we were fine with fixing this odd warning the additional braces
> are simply bogus.
The warning seems generally useful and is enabled by default in gcc-7.
An example of a real bug it found is
https://patchwork.kernel.org/patch/9431813/, so I'd prefer to leave it
enabled and fix the few instances in the kernel.
I found a better way to rework the code to avoid the warning, sending
out v2 now.
Arnd
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] xfs: avoid harmless gcc-7 warnings Arnd Bergmann <arnd@arndb.de> - 2017-05-11 14:50 +0200 Re: [PATCH] xfs: avoid harmless gcc-7 warnings Eric Sandeen <sandeen@redhat.com> - 2017-05-11 15:40 +0200 Re: [PATCH] xfs: avoid harmless gcc-7 warnings Arnd Bergmann <arnd@arndb.de> - 2017-05-11 17:00 +0200 Re: [PATCH] xfs: avoid harmless gcc-7 warnings Christoph Hellwig <hch@infradead.org> - 2017-05-11 18:30 +0200 Re: [PATCH] xfs: avoid harmless gcc-7 warnings Joe Perches <joe@perches.com> - 2017-05-12 16:20 +0200
csiph-web