Forum
Undefined GLOBAL label error on array (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: Undefined GLOBAL label error on array (solved) (/showthread.php?tid=1058)



Undefined GLOBAL label error on array (solved) - short_jonny - 03-27-2021

Hi,
Recently started experimented with the compiler. It's been great so far but I've just started getting unexpected errors using arrays. Compiling the snippet below results in:
test.bas:55: error: Undefined GLOBAL label '._myArray'.  
I can't see why this is failing ?  Am I doing something stupid ?  
I've used 1.14.1 and the latest state of the repo. Is it a bug ?

DIM myArray(1 to 6) as ubyte

SUB Init(byval num as ubyte)
    DIM i as ubyte
    FOR i=1 TO num
        myArray(i) = 0
    NEXT i
END SUB

Init(6)



Jonathan


RE: Undefined GLOBAL label error on array - boriel - 03-27-2021

(03-27-2021, 03:12 PM)short_jonny Wrote: Hi,
Recently started experimented with the compiler. It's been great so far but I've just started getting unexpected errors using arrays. Compiling the snippet below results in:
test.bas:55: error: Undefined GLOBAL label '._myArray'.  
I can't see why this is failing ?  Am I doing something stupid ?  
I've used 1.14.1 and the latest state of the repo. Is it a bug ?

DIM myArray(1 to 6) as ubyte

SUB Init(byval num as ubyte)
    DIM i as ubyte
    FOR i=1 TO num
        myArray(i) = 0
    NEXT i
END SUB

Init(6)



Jonathan

This is a bug.
I'll post a fix soon. Thanks for reporting!


RE: Undefined GLOBAL label error on array - boriel - 03-27-2021

Ok, try this build and tell me if it works, please Rolleyes

http://www.boriel.com/files/zxb/zxbasic-1.15.0-beta14.tar.gz
http://www.boriel.com/files/zxb/zxbasic-1.15.0-beta14.zip
http://www.boriel.com/files/zxb/zxbasic-1.15.0-beta14-win32.zip
http://www.boriel.com/files/zxb/zxbasic-1.15.0-beta14-linux64.tar.gz
http://www.boriel.com/files/zxb/zxbasic-1.15.0-beta14-macos.tar.gz