flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > bug ? [solved]

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 01 Oct 2011, 09:35
Code:
;DOES COMPILE, OK
;----------------

include 'win32a.inc'

struct @Header

 AA        dd ?

; union
;      BB        dd ?
;      struct
       CC        dd ?
      DD        dd ?
;    ends
;      ends
ends

if sizeof.@Header - 0x0C <> 0
  x
end if

mov eax,sizeof.@Header ;<--- eax==0x0C    

Code:
;DOES NOT COMPILE - illegal instruction "x"     (???)
;----------------

include 'win32a.inc'

struct @Header

    AA        dd ?

  union
       BB        dd ?
       struct
       CC        dd ?
      DD        dd ?
     ends
       ends
ends

if sizeof.@Header - 0x0C <> 0
  x
end if

mov eax,sizeof.@Header ;<--- eax==0x0C    

_________________
I am not young enough to know everything (Oscar Wilde)- Image


Last edited by ouadji on 01 Oct 2011, 10:40; edited 1 time in total
Post 01 Oct 2011, 09:35
View user's profile Send private message Send e-mail Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 01 Oct 2011, 10:24
"Illegal instruction", similarly to the "err" directive causes unrecoverable error as soon as it is encountered. This is not a good thing in case of resolving errors - that is ones depended on some addresses/size calculated during the resolving process, because they may have intermediate values that are different from the final ones. If you use some kind of recoverable error instead, you get it to assemble:
Code:
include 'win32a.inc' 

struct @Header 

        AA        dd ? 

        union 
        BB        dd ? 
         struct 
          CC        dd ? 
          DD        dd ? 
         ends 
        ends 
ends 

if sizeof.@Header - 0x0C <> 0 
  rb -1
end if 

mov eax,sizeof.@Header    
Post 01 Oct 2011, 10:24
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji 01 Oct 2011, 10:37

Quote:
because they may have intermediate values that are different from the final ones.
ok, understood boss! Wink
Code:
rb -1    
it works Razz

thank you Tomasz.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 01 Oct 2011, 10:37
View user's profile Send private message Send e-mail 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.