![]() |
Possible array bug in version 1.8.8 (*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: Possible array bug in version 1.8.8 (*solved*) (/showthread.php?tid=860) |
Possible array bug in version 1.8.8 (*solved*) - oblo - 11-08-2018 Hi all I think I've just found a bug in 1.8.8 (or just my Spectrum emulators doesn't work any more); please, look at this piece of code: Code: paper 0: border 0: bright 1: ink 7: cls If I compile the code without the --debug-array parameter, the code works well; but if the --debug-array parameter is used, the Spectrum can create the "testarray" array, but it can't initialize the arrays values, giving a 3 Subscript wrong, 40:1 error. Array-base is 0, heap-size is 4768 and ORG is 24576, but tried with other values and still fails. ![]() ![]() Any ideas? Thanks and cheers. Re: Possible array bug in version 1.8.8 - oblo - 11-11-2018 I' ve continued with more tests and definitely there is some problem with two-dimensional arrays. Look at this code: Code: paper 0: border 0: ink 7: bright 1: cls With 1.8.8 compiler and the --debug-array parameter enabled , code runs until row 2 column 9, no matter what kind of array is defined (BYTE, INTEGER, ULONG, STRING... all of them) ![]() ... BUT if the line "print y; ","; x; " "; array(y,x)" is removed, the code runs well, without errors. I can tell more examples but basically, errors appears only when accessing array data, and never when creating the array or filling it with data. @Boriel, hope it helps. Cheers. Re: Possible array bug in version 1.8.8 - boriel - 11-11-2018 This might be expected if 0 index is out of Range. How are you compiling that code (compiler flags)? Does it also happen If you define the array with (0 to 4)? Re: Possible array bug in version 1.8.8 - oblo - 11-11-2018 boriel Wrote:This might be expected if 0 index is out of Range. How are you compiling that code (compiler flags)? This is how it's compiled: zxb.exe "C:\ZXbasic\tests\testarray.bor" -S 25000 -B -a -t -o "C:\ZXbasic\tests\testarray.tap" --debug-array Sometimes I change the array dimension to start with 1 (SInclair comp) instead 0 with the --array-base=1 parameter but the result is the same, so defining the array (0 to 4) or (1 to 5) doesn't make any difference. Re: Possible array bug in version 1.8.8 - boriel - 11-13-2018 Thanks oblo. It seems I've reintroduced a bug with --debug-array. Will fix it ASAP! Re: Possible array bug in version 1.8.8 - oblo - 11-13-2018 Great! I'll pause the code and, in the meanwhile, I'll start to work on the sprites ![]() Cheers Re: Possible array bug in version 1.8.8 - boriel - 11-15-2018 Ok, can you download it from here? http://boriel.com/files/zxb/zxbasic-zxbasic-1.8.9-beta4-win32.zip http://boriel.com/files/zxb/zxbasic-zxbasic-1.8.9-beta4.tar.gz http://boriel.com/files/zxb/zxbasic-zxbasic-1.8.9-beta4.zip Try this and tell me, please :roll: Re: Possible array bug in version 1.8.8 - oblo - 11-15-2018 Tried the win32 version and I couldn't reproduce previous errors with the same code, so it looks good ![]() For instance, this is another piece of code used to test the bug: Code: paper 0 : border 0: ink 7: cls One dimension arrays always breaks if I tried to access third position or further (so 0 and 1 were OK but 2 gives the Out of Range error) and two dimension arrays always breaks if I tried to access four rows positions or further (so 0,0 1,0 2,0 were good, but 3,0 fails) And it doesn't matter if Array Base is changed or the array was defined like array(5 TO 10) In this case, trying to access array(7) gives the error. But now with 1.8.9 beta4, looks like all these errors are gone ![]() Cheers Re: Possible array bug in version 1.8.8 - boriel - 11-15-2018 8) Thank for the feedback |