flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > [fasmg] err doesn't terminate source processing

Author
Thread Post new topic Reply to topic
zhak



Joined: 12 Apr 2005
Posts: 501
Location: Belarus
zhak 06 Mar 2017, 21:28
Consider the following macro
Code:
macro my? args&
  local flags
  define flags args
  match =a more, flags :
    display 'a'
    redefine flags more
  else match =b more, flags :
    display 'b'
    redefine flags more
  else
    err 'error'
  end match
  while 1
    match :, flags
      break
    end match
  end while
end macro

my c
    


It enters infinite while loop despite first match should have terminated it with error.
Code:
redefine flags :
    

should be explicitely added to else statement for macro to work. I thought that err should terminate source code processing with error
Post 06 Mar 2017, 21:28
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 06 Mar 2017, 22:17
zhak wrote:
I thought that err should terminate source code processing with error
It was this way in fasm 1 but not in fasmg. There are no instant-termination errors in fasmg other than running out of memory. The ERR just collects an error to display (fasmg allows to display multiple errors collected from an entire source). If you write a loop that is at risk of running endlessly, you need to put some safety breaks there yourself.

The thing is: since fasmg allows anything, including symbolic variables and macros, to be forward-referenced, any kind of error might be a false alarm. For this reason the assembler always needs to continue processing, because the error may go away when more values get resolved (just like the arithmetic overflow in fasm 1 did not abort the assembly because it could disappear in a subsequent pass).
Post 06 Mar 2017, 22:17
View user's profile Send private message Visit poster's website 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.