flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > FASM crashes with "if (~eq) && (~)"

Author
Thread Post new topic Reply to topic
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 23 Dec 2006, 05:08
Code:
if (~eq) && ()    

Crashes FASMW 1.67.17 (not tested older versions)

My original code was
Code:
format MS COFF

section '.text' code readable executable 

macro public symbol, size
{

  if (size ~ eq ) && (~ size eqtype 2)
    display "Integer spected",13,10
    err
  end if

  match size, size\{public symbol as \`symbol \# '@' \# \`size\}
}

ProcSize equ
public _ProcName, ProcSize

_ProcName: 

    ; assembler code goes here    

I'm posting it too just in case that both codes raises differents bugs.
Post 23 Dec 2006, 05:08
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 23 Dec 2006, 05:43
Both works fine in FASMW 1.64 (throws the appropiate error of course but without any crash).
Post 23 Dec 2006, 05:43
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 27 Dec 2006, 16:26
This bug keeps in version 27 December 2006 Rolling Eyes
Post 27 Dec 2006, 16:26
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 27 Dec 2006, 16:34
There would be a version number change if there was a modification of core. The frequent updates are due to the interface development (FASMW/FASMD mainly - note that packages for Linux/Unix were not updated).
Post 27 Dec 2006, 16:34
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 27 Dec 2006, 19:12
I guess you were concerned because of the delay between the report and the fix? Wink
Well, it seems that the server has been updated with a new version of Tomasz, which appears to be a bit slower... Very Happy Anyway, 1.67.18 is out.
Post 27 Dec 2006, 19:12
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 27 Dec 2006, 19:37
hahaha, thanks for the fix Smile

BTW, it's OK to no report any error? the following code compiles a nicely 0 byte binary
Code:
if (~eq) && ()
  db "Hello"
end if     


FASM 1.64 inmediately refuses to compile that code telling that there is an invalid value.

Things like "if (~eq) && (~ /-*+-)" is also acepted by the lastest version but not accepted by FASM 1.64 and both doesn't accept "if (~eq) && ~ /-*+-"
Post 27 Dec 2006, 19:37
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 27 Dec 2006, 19:51
This is the so called "lazy evaluation" - when the value before "&" is false, the rest is not even evaluated. Because of the bug that was corrected by 1.67.17, the earlier versions did not skip logical values containing round brackets correctly, however. And the fix in 1.67.17 contained a mistake that made the reported crash.

PS. Latest one DOES accept "if (~eq) && ~ /-*+-".
PS2. Note that "&&" is interpreted as "& (empty logical value) &".
Post 27 Dec 2006, 19:51
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 27 Dec 2006, 20:18
Quote:

PS. Latest one DOES accept "if (~eq) && ~ /-*+-".

You're right :S

Well, it's a little strange to allow invalid expressions, I though that this "lazy evaluation" was just not evaluate subexpresions when not needed BUT still verifying the validity of the entire expression once.

Quote:

PS2. Note that "&&" is interpreted as "& (empty logical value) &".

Sometimes I feel like writing in C apparently Laughing
Post 27 Dec 2006, 20:18
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 27 Dec 2006, 21:28
I was still too hasty, one more correction was needed. There's a silent update, don't tell anyone. Wink

LocoDelAssembly wrote:
Well, it's a little strange to allow invalid expressions, I though that this "lazy evaluation" was just not evaluate subexpresions when not needed BUT still verifying the validity of the entire expression once.

The validity of the ENTIRE expression is still checked - the "if (~eq) && ~ /-*+-" is valid expression, but "if (~eq) & (~ /-*+-" is not. The values themselves are not checked, but since you can compare almost anything with the EQ or EQTYPE operators, that's not that strange.
Post 27 Dec 2006, 21:28
View user's profile Send private message Visit poster's website Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 27 Dec 2006, 21:55
OK Wink
Post 27 Dec 2006, 21:55
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 31 Dec 2006, 08:30
just wondering: any chance to use EQ and EQTYPE on "(" and ")" ?
Post 31 Dec 2006, 08:30
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 31 Dec 2006, 08:53
There's no problem with this now.
Post 31 Dec 2006, 08:53
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.