flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
pfranz
Hello,
I updated my hwtest with the new fasm 1.71.22 and while before it compiled fine, now it gives an error at line 346 in rtl8169.asm. This line is inside and IF 0 / END IF block, so it shouldn't give any error. If I comment it with ; there is no problem, but this looks like a bug. Find attached my hwtest and try to run MAKEFLOP.BAT (if it compiles fine, press CTRL+C to exit).
|
|||||||||||
![]() |
|
pfranz
Yes, the problem is still there also with the latest version
The example is big but I pointed out where the problem is and how to solve it, so it should be easy to deal with it. Just uncompress it and run the batch file. I haven't tried with other situations. |
|||
![]() |
|
revolution
Maybe you could just post the offending line 346 here? I'd much rather that than have to download a file, make a folder, uncompress, open a console, run a command etc.
|
|||
![]() |
|
pfranz
Here it is, it's C code (that's why is inside and IF 0 block, is kind of documentation):
cfg |= (RTL_R32(RxConfig) & rtl_chip_info[tp->chipset].RxConfigMask); ff7e1880 I don't try constructing examples as the problem could be due to the big size of the program or to something somewhere else. Only Tomasz can tell ... |
|||
![]() |
|
revolution
What it appears to be is something similar to this:
Code: if 0 x|=(&) end if |
|||
![]() |
|
pfranz
yes, "invalid expression" is the error
|
|||
![]() |
|
revolution
Remember that fasm has a few different stages. preprocessor/parser/assembler. Each stage is separate. The "if 0" line is processed by the assembler, but the parser is evaluating the logical consistency of the following expression before the assembler has a chance to skip assembling the line. So the error will persist because the parser has no knowledge that the line will never be assembled.
|
|||
![]() |
|
pfranz
I believe "if 0" is processed by preprocessor. Anyway, in the old versions this problem was not present
|
|||
![]() |
|
AsmGuru62
Strange, why not just comment the C code?
|
|||
![]() |
|
Tomasz Grysztar
Correction uploaded as 1.71.29 release.
|
|||
![]() |
|
l_inc
A fix is good, but I suppose, there's a need in a bit of clarification.
pfranz It's still not like you are allowed to put arbitrary things into an "if 0" block. Quote: I believe "if 0" is processed by preprocessor. No it's not. It's handled by the assembler. That's why the following code will still fail to compile: Code: macro x {} if 0 x|=(&) end if A colon at the beginning of a line will fail to compile because of it's special handling as well: Code: if 0 : end if For unclear reasons $% is an invalid name (contrary to %$) and for the same unclear reasons the following also fails to compile: Code: if 0
$%
end if _________________ Faith is a superposition of knowledge and fallacy |
|||
![]() |
|
Tomasz Grysztar
l_inc wrote: A fix is good, but I suppose, there's a need in a bit of clarification. l_inc wrote: For unclear reasons $% is an invalid name (contrary to %$) ... |
|||
![]() |
|
l_inc
Tomasz Grysztar
Quote: Names starting with "$" (and having at least one additional character) are currently always treated as numbers Oh, sure. Thanks. I could have though about this. P.S. Still I'm unable to explain it failing the compilation in an "if 0" block. It should be of no interest for the preprocessor. Is it the following parsing stage, that fails it? But aren't you aiming the parsing stage to be inseparable/indistinguishable from the assembly stage? _________________ Faith is a superposition of knowledge and fallacy |
|||
![]() |
|
Tomasz Grysztar
l_inc wrote: P.S. Still I'm unable to explain it failing the compilation in an "if 0" block. It should be of no interest for the preprocessor. Is it the following parsing stage, that fails it? But aren't you aiming the parsing stage to be inseparable/indistinguishable from the assembly stage? |
|||
![]() |
|
pfranz
Thanks, now it works. I forgot that here IF is an assembler directive, I was used to other compilers where it's a preprocessor one. Maybe MATCH is the one?
|
|||
![]() |
|
l_inc
pfranz
Quote: Maybe MATCH is the one? match is a preprocessor directive that could allow you to skip some source code locations (except for the implications of the fix directive). But it's important to remember that the closing brace character ends the scope of macroblocks. The braces are too common for the C code, which makes macroblocks (including match) not well suitable for skipping C code processing. The best way to comment out the C code is (surprise-surprise!) to use comments. _________________ Faith is a superposition of knowledge and fallacy |
|||
![]() |
|
Tomasz Grysztar
Tomasz Grysztar wrote:
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.