[binutils-gdb] x86: Add () to silence GCC 5

H.J. Lu hjl@sourceware.org
Tue Apr 27 15:21:59 GMT 2021


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=60cfa10c36668e3298bab35e9dc86624f3ddf61a

commit 60cfa10c36668e3298bab35e9dc86624f3ddf61a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Tue Apr 27 08:16:55 2021 -0700

    x86: Add () to silence GCC 5
    
    Add () to !i.prefix[ADDR_PREFIX] to silence GCC 5:
    
    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))
                                   ^
    
            * config/tc-i386.c (optimize_encoding): Add () to silence GCC 5.

Diff:
---
 gas/ChangeLog        | 4 ++++
 gas/config/tc-i386.c | 4 +++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index 03ba1964176..64378d10666 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,7 @@
+2021-04-27  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* config/tc-i386.c (optimize_encoding): Add () to silence GCC 5.
+
 2021-04-26  Jan Beulich  <jbeulich@suse.com>
 
 	* config/tc-i386.c (tc_gen_reloc): Check IS_ELF for
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 99f990464cd..88b601ff742 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -4149,7 +4149,9 @@ optimize_encoding (void)
 	      if (i.op[0].disps
 		  && i.op[0].disps->X_op == O_constant
 		  && i.op[1].regs->reg_type.bitfield.dword
-		  && !i.prefix[ADDR_PREFIX] != (flag_code == CODE_32BIT))
+		  /* NB: Add () to !i.prefix[ADDR_PREFIX] to silence
+		     GCC 5. */
+		  && (!i.prefix[ADDR_PREFIX]) != (flag_code == CODE_32BIT))
 		i.op[0].disps->X_add_number &= 0xffff;
 	    }


More information about the Binutils-cvs mailing list