x86/Intel: fix "near ptr" / "far ptr" handling
authorJan Beulich <jbeulich@suse.com>
Mon, 9 Dec 2019 12:31:07 +0000 (13:31 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 9 Dec 2019 12:31:07 +0000 (13:31 +0100)
Commit dc2be329b950 ("i386: Only check suffix in instruction mnemonic")
broke rejecting of these for floating point insns. Fix this by setting
the "byte" operand attribute, which will now (again) cause an error.

Furthermore the diagnostic for the "far ptr" case in general and for the
"near ptr" case in the non-float cases became "invalid instruction
suffix" instead of the intended "operand size mismatch". Fix this by
also setting the "tbyte" operand attribute (no insn template accepts
both byte and tbyte operands).

gas/ChangeLog
gas/config/tc-i386-intel.c
gas/testsuite/gas/i386/intelbad.l
gas/testsuite/gas/i386/intelbad.s

index 54ede43421b36fb2dcbc0c77b800dd9b060fb1a4..f198b01a441080efe2dbe408442e2a19b88d522b 100644 (file)
@@ -1,3 +1,11 @@
+2019-12-09  Jan Beulich  <jbeulich@suse.com>
+
+       * config/tc-i386-intel.c (i386_intel_operand): Set "byte"
+       attribute suffix instead of suffix for floating point insns when
+       handling O_near_ptr / O_far_ptr.
+       * testsuite/gas/i386/intelbad.s: Add FPU tests.
+       * testsuite/gas/i386/intelbad.l: Adjust expectations.
+
 2019-12-09  Jan Beulich  <jbeulich@suse.com>
 
        * config/tc-i386-intel.c (i386_intel_operand): Set "byte"
index 7d0a5b8d851e5b535db3fe269b46d35d87247209..8eb587b233e29bb2f4fa5f212e111879dce992f3 100644 (file)
@@ -718,9 +718,12 @@ i386_intel_operand (char *operand_string, int got_a_float)
        case O_near_ptr:
          if (current_templates->start->opcode_modifier.jump != JUMP
              && current_templates->start->opcode_modifier.jump != JUMP_DWORD)
-           suffix = got_a_float /* so it will cause an error */
-                    ? BYTE_MNEM_SUFFIX
-                    : LONG_DOUBLE_MNEM_SUFFIX;
+           {
+             /* cause an error */
+             i.types[this_operand].bitfield.byte = 1;
+             i.types[this_operand].bitfield.tbyte = 1;
+             suffix = i.suffix;
+           }
          break;
 
        default:
index 4dc091741f6ba06d24d10557263f37da1d00e9bb..20809136fe02c1ff897b3939619862b119e06046 100644 (file)
 .*:176: Warning: .*
 .*:177: Error: .*
 .*:178: Error: .*
+.*:180: Error: .*
+.*:181: Error: .*
+.*:183: Error: .*
+.*:184: Error: .*
index 93e1c44e84b3ab646bb1ce8bd932e219af644bd3..afbb6035dad5c9cebb2584a3a9ee7b428cb1ed86 100644 (file)
@@ -176,3 +176,9 @@ start:
        lfs     eax, dword ptr [eax]
        lgs     eax, qword ptr [eax]
        lss     eax, tbyte ptr [eax]
+
+       fld     near ptr [ebx]
+       fst     far ptr [ebx]
+
+       fild    far ptr [ebx]
+       fist    near ptr [ebx]
This page took 0.028148 seconds and 4 git commands to generate.