bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug gas/26685] Error: invalid register operand size for `movdir64b'


From: hjl.tools at gmail dot com
Subject: [Bug gas/26685] Error: invalid register operand size for `movdir64b'
Date: Thu, 01 Oct 2020 12:10:46 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=26685

--- Comment #10 from H.J. Lu <hjl.tools at gmail dot com> ---
(In reply to Jan Beulich from comment #9)
> (In reply to H.J. Lu from comment #8)
> > (In reply to Jan Beulich from comment #7)
> > > Of course, that's all fine. But it's still gcc emitting wrong code, which
> > > gas legitimately diagnoses. You've introduced a bug into gas instead of
> > > fixing one.
> > 
> > No.
> 
> How "no"? Just because the compiler produces bad code doesn't mean gas needs
> to correct it. Identical hand-written code like this absolutely needs to be
> diagnosed. As since there's no way to tell hand written code from compiler
> generated one, the fix will need to be in the compiler (otherwise I might
> accept us adjusting things for the compiler's sake).
> 

symbol(%rip) is similar to symbol and DISP.  There is no real register
in memory operand.  I am testing


diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
index 094f555ea01..8f798479baa 100644
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -7179,15 +7179,19 @@ process_suffix (void)
     enum { need_word, need_dword, need_qword } need;

     /* Check the register operand for the address size prefix if
-       the memory operand is symbol(%rip).  */
+       the memory operand has no real registers, like symbol, DISP
+       or symbol(%rip).  */
     if (i.mem_operands == 1
         && i.reg_operands == 1
         && i.operands == 2
-        && i.base_reg
-        && i.base_reg->reg_num == RegIP
-        && i.base_reg->reg_type.bitfield.qword
         && i.types[1].bitfield.class == Reg
-        && i.op[1].regs->reg_type.bitfield.dword
+        && (flag_code == CODE_32BIT
+       ? i.op[1].regs->reg_type.bitfield.word
+       : i.op[1].regs->reg_type.bitfield.dword)
+        && ((i.base_reg == NULL && i.index_reg == NULL)
+       || (i.base_reg
+           && i.base_reg->reg_num == RegIP
+           && i.base_reg->reg_type.bitfield.qword))
         && !add_prefix (ADDR_PREFIX_OPCODE))
       return 0;

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]