flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > mov [eax], 1.0 (in 1.71.27+)

Author
Thread Post new topic Reply to topic
dunkaist



Joined: 31 Jul 2015
Posts: 24
dunkaist 05 Jun 2016, 00:55
Hello,

starting with version 1.71.27 fasm complains on this line.
Code:
mov  [eax], 1.0
error: invalid value.    

Was this compatibility change intentional? Should such a code be modified as follows?
Code:
mov [eax], dword 1.0    

Now it looks very like to following code.
Code:
mov  [eax], 10
error: operand size not specified.    
[/code]
Post 05 Jun 2016, 00:55
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20299
Location: In your JS exploiting you and your system
revolution 05 Jun 2016, 05:14
I think the existence of the error is correct but the error text is misleading. To guarantee you get what you want you should put the size override on the destination:
Code:
mov dword[eax],value    
If "value" is a float and you try to put it into a byte then you will get an error:
Code:
mov byte[eax],3.1415926 ;value cannot fit    
Post 05 Jun 2016, 05:14
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 05 Jun 2016, 07:43
Yes, the error message is incorrect here, it should be like in the "mov [eax],10" case. The size operator has to be required to distinguish "mov dword [eax],1.0" and "mov word [eax],1.0", the latter is allowed since the introduction of F16C instructions.
Post 05 Jun 2016, 07:43
View user's profile Send private message Visit poster's website Reply with quote
dunkaist



Joined: 31 Jul 2015
Posts: 24
dunkaist 05 Jun 2016, 16:18
Thank you for quick replies! I'll update existing code.
Post 05 Jun 2016, 16:18
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8351
Location: Kraków, Poland
Tomasz Grysztar 09 Jun 2016, 10:36
I have corrected the handling of this error in 1.71.54.
Post 09 Jun 2016, 10:36
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.