Author Topic: Problem with using RAX with small immediates.  (Read 8932 times)

nobody

  • Guest
Problem with using RAX with small immediates.
« on: November 12, 2007, 07:50:49 PM »
I assemble the following with nasm version 0.99.06, on Linux V 4.0, and it
appears to get the incorrect opcode (i.e., missing the REX.W prefix).


NASM version 0.99.06 compiled on Nov 11 2007

file: bug_rax.asm
==============================================
CPU X64

section CODE

global _bug1
_bug1:
      enter 16,0
      cmp rax, 0
      je  .get_out
      mov rax, 1

.get_out:
      leave
      ret ;; <------------------------ RETURN


nasm -f elf64 bug_rax.asm

ndisasm -e 448 -b 64 -k 23,265 bug_rax.o

ndisasm (output below):
=====================================================

00000000  C8100000          enter 0x10,0x0
00000004  3D00000000        cmp eax,0x0           <== comparing eax instead of rax ????
00000009  740A              jz 0x15
0000000B  48B8010000000000  mov rax,0x1
         -0000
00000015  C9                leave
00000016  C3                ret
00000017  skipping 0x109 bytes

I am pretty sure this is a bug,

Regards,

Gordon K. Wampler (Unitech Research)

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Problem with using RAX with small immediates.
« Reply #1 on: November 14, 2007, 06:11:11 AM »
Confirmed.

Seems to be fixed in the latest snapshot: nasm-0.99.05-20061113

ftp://ftp.zytor.com/pub/nasm/snapshots

Thanks for the feedback, Gordon!

Best,
Frank

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Problem with using RAX with small immediates.
« Reply #2 on: November 14, 2007, 06:24:32 AM »
That would be nasm-0.99.06-20071113.tar.bz2, of course!

Best,
Frank

nobody

  • Guest
Re: Problem with using RAX with small immediates.
« Reply #3 on: November 14, 2007, 06:13:21 PM »
I downloaded nasm-0.99.07-20071114.tar.bz2, and the problem is now fixed.


Thanks,

Gordon