Forum
Optimiser level 3 bug found (*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: Optimiser level 3 bug found (*solved*) (/showthread.php?tid=511)



Optimiser level 3 bug found (*solved*) - LCD - 11-28-2012

Hi Boriel!
I just ran into a bug with this code:
Code:
paper 7:ink 0:border 7:cls

Function code2level() as ubyte
    dim adr as uinteger
    dim count as ubyte
    adr=@buffer
    count=0
    do
        if not (peek(Uinteger,adr)-peek(Uinteger,@inpstring+3)+peek(Uinteger,adr+2)-peek(Uinteger,@inpstring+5)+peek(Uinteger,adr+4)-peek(Uinteger,@inpstring+7))
            goto passok
        Else
            count=count+1:adr=adr+6
        end if
    loop until count=32
    count=255
    passok:
    return count
end function

print code2level()

End
inpstring:
asm
    defb 1,1,56
    defm "Leveld"
end asm

buffer:
asm
    defm "Level1"
    defm "Level2"
    defm "Level3"
    defm "Level4"
    defm "Level5"
    defm "Level6"
    defm "Level7"
    defm "Level8"
    defm "Level9"
    defm "Level0"
    defm "Levela"
    defm "Levelb"
    defm "Levelc"
    defm "Leveld"
    defm "Levele"
    defm "Levelf"
    defm "Levelg"
    defm "Levelh"
    defm "Leveli"
    defm "Levelj"
    defm "Levelk"
    defm "Levell"
    defm "Levelm"
    defm "Leveln"
    defm "Levelo"
    defm "Levelp"
    defm "Levelq"
    defm "Levelr"
    defm "Levels"
    defm "Levelt"
    defm "Levelu"
    defm "Levelv"
end asm
Without Optimiser or at level 1 or 2 it displays the correct value (13), but with Optimiser level 3 it runs through all the strings aot finding the correct one, so the output is 255 which here means "code not found".


Re: Optimiser level 3 bug found - boriel - 12-14-2012

I've been rather busy. :oops: Sorry.
I've fixed that bug in the latest version 1.3.0 s947, but now other code is suboptimal. :x So still needs some work, I guess.


Re: Optimiser level 3 bug found - LCD - 12-15-2012

boriel Wrote:I've been rather busy. :oops: Sorry.
I've fixed that bug in the latest version 1.3.0 s947, but now other code is suboptimal. :x So still needs some work, I guess.
Thanks! Don't worry, I reduced my retro activity after my father died. Hope to get up soon. Will check the new version tomorrow.


Re: Optimiser level 3 bug found - boriel - 12-17-2012

Oh, I'm very sorry to hear that :!: Sad
My condolences in these sad moments.

Hope you get up and back here soon.


Re: Optimiser level 3 bug found - LCD - 12-17-2012

boriel Wrote:Oh, I'm very sorry to hear that :!: Sad
My condolences in these sad moments.

Hope you get up and back here soon.
Thanks. I hope this too...


Re: Optimiser level 3 bug found - JBGV - 12-26-2012

I had not seen these posts, I'm sorry to read this .

My condolences LCD.


Re: Optimiser level 3 bug found - LCD - 12-27-2012

JBGV Wrote:I had not seen these posts, I'm sorry to read this .

My condolences LCD.
Thank you.


Re: Optimiser level 3 bug found - boriel - 02-12-2013

BTW, is this bug fixed?


Re: Optimiser level 3 bug found - LCD - 02-12-2013

boriel Wrote:BTW, is this bug fixed?
Oops, I forgot to answer: yes, thamks, it was fixed.