flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > I have found not critical bug

Author
Thread Post new topic Reply to topic
EvilsInterrupt



Joined: 02 Jul 2006
Posts: 8
Location: Russia
EvilsInterrupt
Code:
str_ReadFile    db 'ReadFile',0x0
str_WriteFile   db 'WriteFile',0x
str_CloseHandle db 'CloseHandle',0x0    


second string is bad, but fasm it assembled success!
is it not right!


Description:
Download
Filename: bug.asm
Filesize: 1.24 KB
Downloaded: 222 Time(s)


_________________
In code Veritas! (lat.)


Last edited by EvilsInterrupt on 01 Dec 2006, 04:16; edited 2 times in total
Post 30 Nov 2006, 21:50
View user's profile Send private message ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Your uploaded code does not contain the posted code. Anyway, to minimize the code to show the bug (if it's really a bug) is this:
Code:
db 0x    
that's enough on FASMW 1.67.15

I not checked the documentation so that's the reason for that I don't know if it is a bug or not (but looks like a bug or at least has different behavior compared to the common way of handling hex values).

[edit]
documentation wrote:
hexadecimal numbers should begin with 0x characters (like in C language)
Well, since it's supposed to be like C language then this is a bug Razz (and a very old one, FASMW 1.64 has the same behavior)[/edit]
Post 01 Dec 2006, 01:00
View user's profile Send private message Reply with quote
EvilsInterrupt



Joined: 02 Jul 2006
Posts: 8
Location: Russia
EvilsInterrupt
Quote:
Your uploaded code does not contain the posted code

Sorry, file updated.

Code:
api_CloseHandle dd 0
db      0x    

Smile
Post 01 Dec 2006, 04:24
View user's profile Send private message ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Well, it's not a bug Embarassed. I'm trying to upload an image to imageshack but my internet connection has serious routing problems and I can just reach few sites (like this). I'll upload it as soon as posible but in advance I can tell that things like "a = 0x+5" and "return 0x" is accepted by Turbo C 2.0

[edit]
Image
Before:
Code:
Traza a la dirección imageshack.us [38.99.76.137]
sobre un máximo de 30 saltos:

  1     *        *        *     Tiempo de espera agotado para esta solicitud.
  2    18 ms    19 ms    19 ms  200.51.241.249
  3    18 ms    19 ms    20 ms  200.51.233.142
  4    10 ms    19 ms    19 ms  200.51.233.135
  5     *        *        *     Tiempo de espera agotado para esta solicitud.
  6     *        *        *     Tiempo de espera agotado para esta solicitud.
.
.
.
    

Now Very Happy:
Code:
Traza a la dirección imageshack.us [38.99.76.137]
sobre un máximo de 30 saltos:

  1     *        *        *     Tiempo de espera agotado para esta solicitud.
  2    12 ms    10 ms    11 ms  200.51.241.249
  3    11 ms    10 ms    11 ms  200.51.233.142
  4    10 ms    10 ms    11 ms  200.51.233.135
  5    73 ms    69 ms    11 ms  213.140.36.218
  6   137 ms    69 ms    68 ms  213.140.43.69
.
.
.
    

[/edit]
Post 01 Dec 2006, 13:33
View user's profile Send private message Reply with quote
EvilsInterrupt



Joined: 02 Jul 2006
Posts: 8
Location: Russia
EvilsInterrupt
Ok, I`m understand.
Sorry my english is bad! But I`m stady it is language now
Post 01 Dec 2006, 14:45
View user's profile Send private message ICQ Number Reply with quote
optimizator



Joined: 15 Dec 2006
Posts: 2
Location: Russia
optimizator
I don't want to make a new thread - I find another bug. When I'm using global variables (FASMINC defined into "My Computer") this code cause error:
Code:
format PE GUI 4.0
entry start
include '%FASMINC%\win32a.inc'
...
section '.code' code executable
start:
...
    

When line entry start is absent there, compilation success!
Next code fragment was compiled normally:
Code:
format PE GUI 4.0
include '%FASMINC%\win32a.inc'
...
section '.code' code executable
start:
...
.end start
    
Post 15 Dec 2006, 19:23
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7797
Location: Kraków, Poland
Tomasz Grysztar
I'm not able to reproduce this problem, can you post more complete information?
Post 15 Dec 2006, 19:32
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
Quote:
format PE GUI 4.0
entry start
include '%FASMINC%\win32a.inc'
...
section '.code' code executable
start:
...


Did you include a "ret" or "ExitProcess, 0Confused
Post 15 Dec 2006, 21:04
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
optimizator



Joined: 15 Dec 2006
Posts: 2
Location: Russia
optimizator
Excuse, but I think it not an error of the compiler. When I have added section of import - the program has earned:
Code:
format PE GUI 4.0
entry start
include '%FASMINC%\WIN32AXP.INC'
section '.code' code readable executable
start:
invoke ExitProcess,1
section '.idata' import readable
library kernel,'KERNEL32.DLL'
import kernel,ExitProcess,'ExitProcess'
    

But why the following code works without creation of section of import?
Code:
format PE GUI 4.0
include '%FASMINC%\WIN32AXP.INC'
section '.code' code readable executable
start:
invoke ExitProcess,1
.end start
    

And the last question: how I can disable generation by the compiler of a prologue and an epilogue of function? For example in MASM it is done so:
Code:
option prologue:none
option epilogue:none
    
Post 16 Dec 2006, 07:44
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 7797
Location: Kraków, Poland
Tomasz Grysztar
Answer for the first question comes from Win32 headers documentation, section 2.2:
Quote:
The extended headers enable some macroinstructions that help with easy structuring the program. The .data and .code are just the shortcuts to the declarations of sections for data and for the code. The .end macroinstruction should be put at the end of program, with one parameter specifying the entry point of program, and it also automatically generates the import section using all the standard import tables.


For the second problem: you may even do it exactly as in MASM, if you include MACRO/MASM.INC file, which defines "option" macro.
Post 16 Dec 2006, 08:23
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-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.