[PATCH] x86: Add () to silence GCC 5

H.J. Lu hjl.tools@gmail.com
Tue Apr 27 15:20:44 GMT 2021


On Tue, Apr 27, 2021 at 12:42 AM Jan Beulich via Binutils
<binutils@sourceware.org> wrote:
>
> On 26.04.2021 19:08, Joseph Myers wrote:
> > On Fri, 23 Apr 2021, Jan Beulich via Binutils wrote:
> >
> >> +              && !i.prefix[ADDR_PREFIX] != (flag_code == CODE_32BIT))
> >
> > I'm seeing a -Werror build failure (with GCC 5):
> >
> > /scratch/jmyers/glibc-bot/src/binutils/gas/config/tc-i386.c: In function 'optimize_encoding':
> > /scratch/jmyers/glibc-bot/src/binutils/gas/config/tc-i386.c:4152:31: error: logical not is only applied to the left hand side of comparison [-Werror=logical-not-parentheses]
> >      && !i.prefix[ADDR_PREFIX] != (flag_code == CODE_32BIT))
>
> Well, not sure what to say. For one I consider the warning bogus. It
> should be up to the programmer how booleans on either side of
> relational operators get expressed. ! is no worse or better than ==
> or any other relational operator. For example, personally I consider
>
>      && !i.prefix[ADDR_PREFIX] == !(flag_code == CODE_32BIT))
>
> worse.
>
> And then, if you think this is worthwhile fixing (which probably it
> is, as we're unlikely to want to state that binutils don't build
> with gcc 5), how about you submit a patch, since you've noticed the
> issue and hence you are in a position to check whether whatever
> possible change doesn't again trigger some kind of (bogus or not)
> warning?
>
> Jan

I am checking in this to silence GCC 5.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-x86-Add-to-silence-GCC-5.patch
Type: text/x-patch
Size: 1585 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20210427/1786961c/attachment.bin>


More information about the Binutils mailing list