xc-basic3
xc-basic3 copied to clipboard
Assembly error when using string and SELECT CASE in FUNCTION
I'm really new to XC=BASIC, but I think I came across a bug. This is the minimal code example I came up with to reproduce the behaviour:
FUNCTION myfunc AS BYTE ()
DIM s AS STRING * 1
SELECT CASE s
END SELECT
END FUNCTION
PRINT myfunc()
Running $ xcbasic3 test.bas test.prg --target=pet8032 ends with this error message:
test.bas:6.0: WARNING: FUNCTION "myfunc()" never calls itself, consider making it STATIC
** ERROR ** There has been an error while trying to execute DASM, please see the bellow message.
Tried to execute: dasm /tmp//xcbtmp_FEBB3EF0.asm -otest.prg -s/tmp//xcbtmp_FEBB3EF0.sym
char = '{' 123 (-1: 35)
char = '}' 125 (-1: 50)
char = '{' 123 (-1: 35)
char = '}' 125 (-1: 50)
char = '{' 123 (-1: 35)
char = '}' 125 (-1: 50)
/tmp//xcbtmp_FEBB3EF0.asm (59): error: Not enough args passed to Macro.
/tmp//xcbtmp_FEBB3EF0.asm (59): error: Illegal character '{2}'.
/tmp//xcbtmp_FEBB3EF0.asm (59): error: Illegal character '}'.
Unrecoverable error(s) in pass, aborting assembly!
Complete. (5)
Edit: I'm using XC=BASIC version 3.1.11.
Yeah it looks like bug. I could reproduce it with this example:
DIM s$ AS STRING * 1
s$ = "e"
SELECT CASE s$
CASE "e"
PRINT "it works"
CASE ELSE
PRINT "bad"
END SELECT