![]() |
Another optimizer bug (*solved*) - 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: Bug Reports (https://www.boriel.com/forum/forumdisplay.php?fid=15) +---- Thread: Another optimizer bug (*solved*) (/showthread.php?tid=621) |
Another optimizer bug (*solved*) - einar - 11-04-2014 Ouch! This bug gave me a headache! It took me some time to figure out the reason my game was crashing... Take a look at this sample: Code: sub test() Try compiling this sample above using: Code: zxb.exe -A -O2 prog.bas And it will produce the expected result: Code: _test: However try compiling it again using: Code: zxb.exe -A -O3 prog.bas Now the result won't make sense anymore: Code: _test: The problem is, the optimizer is supposed to try to optimize its own generated code only, not someone else's assembly code that it doesn't have enough information to understand! Re: Another optimizer bug - boriel - 12-27-2014 Try and download the new version ZX BASIC 1.4.0s1902. It's true the compiler should not optimize user's asm code. But at the moment it's not implemented. However, the bug was it was not taking into account neither the I register nor the IM instruction. So it was a bug anyway. ![]() Now your example works ok for me. Can you try it, please?? Re: Another optimizer bug - einar - 12-27-2014 It works, thanks a lot! Re: Another optimizer bug - boriel - 12-27-2014 einar Wrote:It works, thanks a lot!You're welcome! ![]() A trick to avoid the compiler to optimize your code is to encode the asm using DEFB, DEFW (the bytes) but it's a so hard task... :roll: |