MASM64 SERIOUS BUG - by Roman313

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 620186 Comments
Status Closed Workarounds
Type Bug Repros 1
Opened 11/9/2010 7:12:19 AM
Access Restriction Public

Description

Hi !
MASM64 (ML64) has serious bug:

can't compile asm-file like this:

mov [rax], offset any_function
ML64 show error:
A2070: "invalid instruction operands"

When I try like this:
mov qword ptr [rax], offset any_function
ML64 show error:
A2084: "constant value too large"

When I using Flat Assembler (FASM),
this construction:
mov qword ptr [rax], offset any_function
compiled and work OK.

What does at mean ?
What can I do with MASM ?
Any MASM patch exists ?

Please, answer to: avtukhoff@hotmail.com
Sign in to post a comment.
Posted by Roman313 on 3/10/2011 at 1:31 PM
Not sure.
FASM work OK, its parsed this write.
Posted by Bill [MSFT] on 1/14/2011 at 2:38 PM
Thank you for contacting Microsoft and for using the Microsoft Macro Assembler.

In 64-bit mode the MOV instruction can have a 64-bit immediate for some encodings such as:

MOV RAX, OFFSET FXN

But the instruction form that writes 64 bits to memory, such as:

MOV QWORD PTR [RAX], 0

is limited to a 32-bit immediate. When the assembler sees:

MOV QWORD PTR [RAX], OFFSET FXN

the immediate evaluates to a 64-bit value, which is too large to accept as an immediate.

I would suggest you use an intermediate step to store the offset in a register and then store that register to the memory location. This would look something like:

MOV RBX, OFFSET FXN
MOV [RAX], RBX

Hope this helps
Microsoft Visual Studio Team
Posted by Microsoft on 11/9/2010 at 7:24 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)