Unused functions confuse optimizer
I was trying to implement joystick reading, but my program crashed. Here is the minimal code that still crashes and can demonstrate the problem. (I cloned the latest xcbasic today).
TYPE Joystick
SUB Update() STATIC
END SUB
SUB WaitClick() STATIC
DO
CALL THIS.Update()
LOOP
END SUB
FUNCTION XAxis AS INT() STATIC
RETURN 0
END FUNCTION
END TYPE
DIM Joy2 AS Joystick SHARED
PRINT Joy2.XAxis()
I can't test it right now but can you try with RETURN CINT(0)?
That has no effect. The funny thing is that if I remove Update call from WaitClick then XAxis call will work (Update and WaitClick are not even called).
...also without optimizer it seems to work
It's a bug in the optimizer. I'll fix that.
A temporary solution is to remove functions that aren't called.
Same problem here! Please support. Thanks.