This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: PR gas/5534: "XXX PTR" isn't checkedproperlyinIntelsyntax


>There are 2 cases when Unspecified is used with more than one sizes:
>
>1. Only one size is allowed given the second operand, like
>
>movw (%eax), %ax
>movl (%eax), %eax
>mov ax, WORD PTR [ebx]
>mov eax, DWORD PTR [ebx]
>
>2. 64bit extension adds a new size and we don't want to disallow the 32bit
>default version:
>
>bash-3.2$ cat x.s
>        .intel_syntax noprefix
>cvtsi2sd xmm1, [rax]
>cvtsi2sd xmm1,DWORD PTR [rax]
>cvtsi2sd xmm1,QWORD PTR [rax]

I don't think this is desirable - if 64bit specifies two sizes, programmers
should be explicit in selecting them. I'm pretty certain MASM enforces
this, too, so again I'd want it to work that way at least in Intel mode.

>If you can find a case where Unspecified is used with more than 1 sizes
>in a different way, please let me know.

- base opcode 0xC6 (the immediate doesn't allow deriving a size)
- movsx
- movzx
- push (base opcode 0xFF)
- pop (base opcode 0x8F)
- base opcodes 0x80 and 0x83
- inc/dec (base opcode 0xFE)

etc (I stopped here, as the problem seems to be too wide-spread). The
only exception that I can see being useful are operations that act on the
stack (push, pop, call) as well as branches through a memory operand:
defaulting these to the native size may be useful, but strictly speaking
even there the programmer ought to be required to specify an explicit
size (and again I think MASM enforces this).

Jan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]