flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Bug in relative instruction in 64-bit mode

Author
Thread Post new topic Reply to topic
CandyMan



Joined: 04 Sep 2009
Posts: 413
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 08 Feb 2014, 22:59
Code:
use64
org 0xFFC00000

include "if.inc"

MainProcedure:
         .if ([Items]=0)|([Count]<>0)
            nop
         .endif
         ret

Items dq ?
Count dq ?
    

Error: relative jump out of range

_________________
smaller is better
Post 08 Feb 2014, 22:59
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 08 Feb 2014, 23:59
Tried the following code with versions 1.71.10, 1.71.17 and 1.71.18, all compiled without trouble.
Code:
use64
org 0xFFC00000

include "macro/if.inc" ; Only change I made

MainProcedure:
         .if ([Items]=0)|([Count]<>0)
            nop
         .endif
         ret

Items dq ?
Count dq ?    
Post 08 Feb 2014, 23:59
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 09 Feb 2014, 07:20
CandyMan,

There should be something really strange with your version of fasm, I've managed to compile your source with this list of stock Win32 compilers:
Code:
>FASM.EXE out_of_range.fasm
flat assembler  version 1.66
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.68  (1505318 kilobytes memory)
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.69.16  (1504489 kilobytes memory)
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.69.32  (1504900 kilobytes memory)
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.69.48  (1504794 kilobytes memory)
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.69.52  (1502497 kilobytes memory)
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.70  (1502417 kilobytes memory)
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.70.01  (1502540 kilobytes memory)
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.70.02  (1502105 kilobytes memory)
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.70.03  (1501808 kilobytes memory)
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.71.00  (1502867 kilobytes memory)
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.71.04  (1499272 kilobytes memory)
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.71.08  (1500163 kilobytes memory)
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.71.12  (1048576 kilobytes memory)
3 passes, 22 bytes.

>FASM.EXE out_of_range.fasm
flat assembler  version 1.71.16  (1048576 kilobytes memory)
3 passes, 22 bytes.    
Pre-1.66 compilers gave me error messages that were unrelated to relative jumps (something with .if macro itself).

Does anybody have intact 1.60 fasm distribution archive?
Post 09 Feb 2014, 07:20
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20298
Location: In your JS exploiting you and your system
revolution 09 Feb 2014, 08:54
baldr wrote:
Does anybody have intact 1.60 fasm distribution archive?
Code:
flat assembler  version 1.60
         .if ([Items]=0)|([Count]<>0)
C:\Documents and Settings\We are the Borg\Our Documents/macro/if.inc [12] .if [7]:
   cmp v1,0
error: invalid operand.    
And the same for 1.61. Then:
Code:
flat assembler  version 1.62
         .if ([Items]=0)|([Count]<>0)
C:\Documents and Settings\We are the Borg\Our Documents/macro/if.inc [12] .if [7]:
  JCOND __ELSE,arg
C:\Documents and Settings\We are the Borg\Our Documents/macro/if.inc [95] JCOND [16]:
   cmp v1,v2
error: invalid operand.    
And the same for 1.62 through 1.65. Then:
Code:
flat assembler  version 1.66
3 passes, 22 bytes.    
Post 09 Feb 2014, 08:54
View user's profile Send private message Visit poster's website Reply with quote
CandyMan



Joined: 04 Sep 2009
Posts: 413
Location: film "CandyMan" directed through Bernard Rose OR Candy Shop
CandyMan 09 Feb 2014, 12:11
Change "|" with "&" and try again Embarassed
Code:
use64
org 0xFFC00000

include "macro/if.inc"

MainProcedure:
         .if ([Items]=0)&([Count]<>0)
            nop
         .endif
         ret

Items dq ?
Count dq ?
    

_________________
smaller is better
Post 09 Feb 2014, 12:11
View user's profile Send private message Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc 09 Feb 2014, 13:02
Seems in fact to be a bug. Minimal reproducible example:
Code:
use64
org 0x80000000-4
label lbl at @F
jmp lbl
@@:    

Here lbl is assumed to be located at 0 and the relative offset overflow is for some reason a non-continuable error. Thus no additional pass is made to resolve the label correctly.

_________________
Faith is a superposition of knowledge and fallacy
Post 09 Feb 2014, 13:02
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20298
Location: In your JS exploiting you and your system
revolution 09 Feb 2014, 13:09
'tis now sticky.
Post 09 Feb 2014, 13:09
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8349
Location: Kraków, Poland
Tomasz Grysztar 09 Feb 2014, 13:34
Please check the 1.71.19 development release.
Post 09 Feb 2014, 13:34
View user's profile Send private message Visit poster's website Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc 09 Feb 2014, 13:53
Tomasz Grysztar
I just noticed, that the compiled console version in the archive with 1.71.17 is actually a 1.71.18 .

_________________
Faith is a superposition of knowledge and fallacy
Post 09 Feb 2014, 13:53
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8349
Location: Kraków, Poland
Tomasz Grysztar 09 Feb 2014, 13:57
It had been assembled with a wrong version string by mistake, but it not the same as 1.71.18 feature-wise.
Post 09 Feb 2014, 13:57
View user's profile Send private message Visit poster's website Reply with quote
l_inc



Joined: 23 Oct 2009
Posts: 881
l_inc 09 Feb 2014, 13:58
Tomasz Grysztar
I checked the irpv support, and it's present there.

_________________
Faith is a superposition of knowledge and fallacy
Post 09 Feb 2014, 13:58
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8349
Location: Kraków, Poland
Tomasz Grysztar 09 Feb 2014, 14:01
There was a 1.71.17 package that had a 1.71.18 version string before I even started working on IRPV. The one that you have must be some variant mixed later (probably when I tried to correct that initial mistake).
Post 09 Feb 2014, 14:01
View user's profile Send private message Visit poster's website Reply with quote
sid123



Joined: 30 Jul 2013
Posts: 339
Location: Asia, Singapore
sid123 09 Feb 2014, 14:47
Wow this thread is sticky!
Post 09 Feb 2014, 14:47
View user's profile Send private message Reply with quote
HaHaAnonymous



Joined: 02 Dec 2012
Posts: 1178
Location: Unknown
HaHaAnonymous 09 Feb 2014, 16:42
[ Post removed by author. ]


Last edited by HaHaAnonymous on 28 Feb 2015, 18:17; edited 1 time in total
Post 09 Feb 2014, 16:42
View user's profile Send private message Reply with quote
DOS386



Joined: 08 Dec 2006
Posts: 1900
DOS386 19 Feb 2014, 16:07
> console version in the archive with 1.71.17 is actually a 1.71.18

same problem 1.71.16-vs-1.71.17 (YES I have both ...)

and there is a strange edit in 1.71.16.5 in BLOCKS.INC :

Code:
        call    set_line
        jc      full_lines_inserted
        jmp     insert_full_lines
    full_lines_inserted:
        pop     edi
        mov     eax,[caret_line]
    


and a new file "fasm17119.zip\SOURCE\IDE\VERSION.INC 1'859 2014-01-27 15:17" ... maybe "EVERSION.INC" would be better Wink
Post 19 Feb 2014, 16:07
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.