Author Topic: Operand size mismatch with explicit immediate size  (Read 5731 times)

Offline parthy

  • New Member
  • Posts: 1
Operand size mismatch with explicit immediate size
« on: February 05, 2016, 05:52:27 PM »
When I try to force a particular instruction variant like this:
Code: [Select]
BITS 64
add qword [rax], dword 0x7FFFFFFF

I get a "mismatch in operand size error". While it is a mismatch, it is a perfectly valid instruction: ADD r/m64, imm32. If I remove the "dword" qualifier, it works and spits out this very instruction. But in my use case, I actually want to be able to specify a particular combination of operands. If this combination does not result in a valid instruction, I want nasm to fail, otherwise to succeed. Is it intentional that nasm will bail out with an error even though the specified instruction is valid?

I'd appreciate your help.