flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Addressing mode bug

Author
Thread Post new topic Reply to topic
El Tangas



Joined: 11 Oct 2003
Posts: 120
Location: Sunset Empire
El Tangas
I actually got some productive result out of the xor reg, reg thread runing in
Main.

I found that fasm assembles the non-existing addressing mode [0*reg32] as
[reg32], while trying to assemble lea eax, [0*eax]...

It should generate an error or assemble [0], right?
Post 17 Dec 2006, 17:01
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
nice one Very Happy
Post 17 Dec 2006, 17:12
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: 7801
Location: Kraków, Poland
Tomasz Grysztar
Indeed, nice one, and about as old as fasm itself. Fixed in 1.67.16.
Post 17 Dec 2006, 18:12
View user's profile Send private message Visit poster's website Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak
El Tangas wrote:
I actually got some productive result out of the xor reg, reg thread runing in
Main.


are you saying that using the following code to 0 a register is bad?

Code:
xor eax, eax    
Post 17 Dec 2006, 20:11
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
El Tangas



Joined: 11 Oct 2003
Posts: 120
Location: Sunset Empire
El Tangas
vid, Tomasz: Well, tnx, guys, I do try... Wink

kohlrak: Ah, Good and Bad... It is my personal belief that all forms of zeroing a register have their place in this world. So xor reg, reg is ok for me. However, this is not the right place to discuss this, since there is that thread in the Main forum.
Post 17 Dec 2006, 20:39
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
A similar issue is still present:
Code:
irp m, -1, -2, -3, -4, -5, -8, -9
{
  alpha = m
  lea eax, [eax*m]
  lea ecx, [esi*(m)]
  lea edx, [ebx*alpha] ; Only to confirm it doesn't fail with literals only
}    
Post 29 Aug 2009, 23:06
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7801
Location: Kraków, Poland
Tomasz Grysztar
Wow, this one was really old. The code I had to modify to fix it was not touched since the dark ages in the very beginning of fasm development. Smile
Fixed in 1.69.04.
Post 30 Aug 2009, 00:11
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: 4633
Location: Argentina
LocoDelAssembly
hehe well, this bug is probably really hard to be noticed in real code. Actually I found it because after reading some stuff about formal methods I though of testing this, I wasn't doing any Assembly programming today.

There is something I'm not sure if it is right or wrong.

This works:
Code:
lea eax, [eax-eax*-2] ; Assembled as "lea eax, [eax+eax*2]"
lea eax, [0-eax*-2]   ; Assembled as "lea eax, [eax+eax]"    
But this doesn't:
Code:
lea eax, [-eax*-2] ; Invalid expression (should it be assembled as "lea eax, [eax+eax]"?)    
Post 30 Aug 2009, 00:45
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.