Add parentheses to prevent truncated addresses
authorH.J. Lu <hjl.tools@gmail.com>
Mon, 15 Feb 2016 23:58:42 +0000 (15:58 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Tue, 16 Feb 2016 00:03:58 +0000 (16:03 -0800)
* i386-dis.c (print_insn): Parenthesize expression to prevent
truncated addresses.
(OP_J): Likewise.

opcodes/ChangeLog
opcodes/i386-dis.c

index 24c16806bff7a814aa47deb990dcbda17bdb87e8..e9f157880d609476e1faa00f572c13571cbca529 100644 (file)
@@ -1,3 +1,9 @@
+2016-02-15  H.J. Lu  <hongjiu.lu@intel.com>
+
+       * i386-dis.c (print_insn): Parenthesize expression to prevent
+       truncated addresses.
+       (OP_J): Likewise.
+
 2016-02-10  Claudiu Zissulescu  <claziss@synopsys.com>
            Janek van Oirschot  <jvanoirs@synopsys.com>
 
index 5f4aed566d696545708e86d6097f76a008e2eb32..de0534c24e7dea107281d61e4eea4007181a44a7 100644 (file)
@@ -13644,7 +13644,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
     if (op_index[i] != -1 && op_riprel[i])
       {
        (*info->fprintf_func) (info->stream, "        # ");
-       (*info->print_address_func) ((bfd_vma) (start_pc + codep - start_codep
+       (*info->print_address_func) ((bfd_vma) (start_pc + (codep - start_codep)
                                                + op_address[op_index[i]]), info);
        break;
       }
@@ -16158,7 +16158,7 @@ OP_J (int bytemode, int sizeflag)
             the displacement is added!  */
          mask = 0xffff;
          if ((prefixes & PREFIX_DATA) == 0)
-           segment = ((start_pc + codep - start_codep)
+           segment = ((start_pc + (codep - start_codep))
                       & ~((bfd_vma) 0xffff));
        }
       if (address_mode != mode_64bit