Lazarus

Free Pascal => General => Topic started by: Kays on May 16, 2018, 11:13:10 am

Title: asm: j is jo, but only sometimes
Post by: Kays on May 16, 2018, 11:13:10 am
Hi,

why does my attached program translate an instruction into something totally different? I use FPC 3.0.4.

Code: ASM  [Select][+][-]
  1. $ objdump -d --start-address=0x4001d8 --stop-address=0x4001e5 -M intel --insn-width=4 sizeOfDemo
  2.  
  3. sizeOfDemo:     file format elf64-x86-64
  4.  
  5.  
  6. Disassembly of section .text:
  7.  
  8. 00000000004001d8 <P$SIZEOFDEMO_$$_SUM$array_of_SMALLINT$$INT64+0x18>:
  9.   4001d8:       66 8b 14 4e     mov    dx,WORD PTR [rsi+rcx*2]
  10.   4001dc:       48 01 d0        add    rax,rdx
  11.   4001df:       70 04           jo     4001e5 <P$SIZEOFDEMO_$$_SUM$array_of_SMALLINT$$INT64+0x25>
  12.   4001e1:       e2 f5           loop   4001d8 <P$SIZEOFDEMO_$$_SUM$array_of_SMALLINT$$INT64+0x18>
  13.   4001e3:       70 03           jo     4001e8 <P$SIZEOFDEMO_$$_SUM$array_of_SMALLINT$$INT64+0x28>
The second jo-instruction clearly reads in the source code as j @sum_done (unconditional)
Title: Re: asm: j is jo, but only sometimes
Post by: marcov on May 16, 2018, 11:25:37 am
I don't know the "j" mnemonic, but best is to file a bug. Maybe test with the normal opcode ("jmp") first.
Title: Re: asm: j is jo, but only sometimes
Post by: Kays on May 16, 2018, 11:35:48 am
I don't know the "j" mnemonic, but best is to file a bug. Maybe test with the normal opcode ("jmp") first.
Bingo.
TinyPortal © 2005-2018