![]() |
Missing label issue *found* - Printable Version +- Forum (https://www.boriel.com/forum) +-- Forum: Compilers and Computer Languages (https://www.boriel.com/forum/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://www.boriel.com/forum/forumdisplay.php?fid=11) +---- Forum: Help & Support (https://www.boriel.com/forum/forumdisplay.php?fid=16) +---- Thread: Missing label issue *found* (/showthread.php?tid=212) |
Missing label issue *found* - britlion - 04-21-2010 I have a program (fourspriter. Yet again!) that has a compilation error "no such label". Except I can see it. Right there! :-) Am I going crazy? I copied and pasted the following code into a separate project: Code: SUB FASTCALL fspUpdate() And it compiled perfectly. Which is bad, because this is FULL of references that don't exist. However, when I try the main code block, it reports: FourSpriter3.bas:906: Error: Undefined label 'fspUpdateAsm' Now, quite apart from the fact that line 906 reads " ;LD BC,2120 "- which means I have to hunt down the line it really means, that label is only used in two places. Both of those places are shown in the code above. One call and one arrival point. I have NO idea why it's doing this. It's weird that it doesn't like the label in the main program, and yet is fine with all those other undefined labels in the part above. Any idea what's going on here? Re: Missing label issue - britlion - 04-21-2010 Oh.. -O3 was in the build. I'm guessing the optimizer...er optimized it out of existence. *sigh* Sometimes it's tricky, this programming thing. Especially with half-built code. Re: Missing label issue - boriel - 04-29-2010 britlion Wrote:Oh..Mixing ASM with a high level language is always tricky on any compiler (even GCC, Borland Pascal, etc...). And should be used only in special cases (high performance routines, graphics or sound). Other than that you should avoid it as much as possible: the compiler DOES NOT understand ASM but basic. When it enters and ASM block it just skips it and pass it to the assembler on a 2nd stage along with the ASM code it generates. It will try even to make some optimizations on your code, but will mostly not since it won't know your "intentions" (semantics). Regarding to your error, you are defining a label *within* an ASM block and calling it from outside (BASIC Environment). Move the fspUpdateAsm: label out of the asm block and put it just above the ASM... opening. This should work. |