Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Compiler/Delphi/BASM    [ Add a report in this area ]  
Report #:  129696   Status: Open
[Win64] Invalid assembly opcode for PUSH with 8-byte argument
Project:  Delphi Build #:  21.0.17707.5020
Version:    21.0 Submitted By:   Marcin Wiazowski
Report Type:  Crash / Data loss / Total failure Date Reported:  1/11/2015 3:39:48 PM
Severity:    Critical / Show Stopper Last Updated: 1/12/2015 11:58:52 PM
Platform:    All versions Internal Tracking #:   57986
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
For both x32 and x64 modes, maximum allowed size of a constant argument for PUSH instruction is a 32-bit number. However, in x64 mode, BASM accepts also a 64-bit number as a PUSH parameter - this generates an invalid assembly code. An "E2116 Invalid combination of opcode and operands" compilation error should be raised instead.

This may be a hard-to-find problem, when the PUSH instruction gets some constant as a parameter, which is calculated by using some other constants (so it's not clearly visible, that it is a 64-bit number).

Tested with XE7 Update 1.
Steps to Reproduce:
Compile and disassemble the following example:

----------------
program Test;
asm
  NOP
  NOP
  NOP
  NOP
  NOP
  NOP
  NOP
  NOP

  {x64: "E2116 Invalid combination of opcode and operands"
   compilation error should be raised, exactly as in x32.
   Currently, an invalid assembly code is generated instead}
  PUSH 1122334455667788h

  NOP
  NOP
  NOP
  NOP
  NOP
  NOP
  NOP
  NOP
end.
----------------
Disassembler output:

nop
nop
nop
nop
nop
nop
nop
nop
push    55667788h
xor     r12d, [rdx]
adc     [rax-6F6F6F70h], edx
nop
nop
nop
----------------
Workarounds
None
Attachment
129696.zip
Comments

None

Server Response from: ETNACODE01