Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
One more optimizer bug (*solved*)
File "test.bas":

sub test()
        ld      hl, 56469
        ld      de, 5
        ld      (hl), e
        inc     l
        ld      (hl), d
;        ret
    end asm
end sub


Trying to compile it:

>zxb.exe -t -O3 test.bas -o test.tap
Traceback (most recent call last):
  File "", line 348, in <module>
  File "", line 301, in main
  File "optimizer.pyc", line 2290, in optimize
  File "optimizer.pyc", line 1949, in optimize
  File "optimizer.pyc", line 680, in op
  File "optimizer.pyc", line 538, in inc
  File "optimizer.pyc", line 432, in set
TypeError: unsupported operand type(s) for <<: 'NoneType' and 'int'

Compiling it without "-O3" works just fine.
Regardless of the problem itself, it worries me that the compiler is trying to optimize my assembly code. I certainly understand more about my assembly code context than the compiler, so any attempt by the compiler to "improve" it will most likely break something.

Even if it's necessary for the compiler to analyze small assembly snippets in the middle of a BASIC routine (in order to figure out how to integrate Assembly code with surrounding BASIC code)... perhaps compiler optimization could be disabled whenever a routine is written 100% in Assembly? Or perhaps ZX BASIC could provide a directive (or command-line option) to disable attempts to optimize Assembly code implemented by the programmer, and only optimize Assembly code produced by the compiler?
Is this bug still pending?? Confusedhock:

Anyway, yes, the compiler should not optimize users code and this will be fixed.
boriel Wrote:Is this bug still pending??

Yes. Tested against latest version 1.4.0s1967.
Well, I'm finally addressing it (also fixed another two already, available in version s1975, but wait until I also fix this one).
I'm also trying to integrate the "don't optimize the user asm code" feature.

Update: Version 1.4.0s1980 is out.
Hope it's not too late :|
If you're still interested, try and tell me, please.
Note: This version does still optimize ASM user code (work in progress...)
Thank you!!!
Ok. Now updated!
Okay, from version 1.6.6 and on, user's asm code won't be optimized regardless of the -O flag 8)

Forum Jump:

Users browsing this thread: 1 Guest(s)