fix crash in long address-of

This commit is contained in:
Irmen de Jong
2025-11-08 21:09:35 +01:00
parent da3c7f267f
commit afb458a7da
3 changed files with 30 additions and 43 deletions

View File

@@ -1,33 +1,11 @@
%import textio
main {
sub start() {
ubyte[] array = ['h', 'e', 'l', 'l', 'o', 0]
str name = "hello"
name[5] = '!' ; don't do this in real code...
name[5] = 0
name[6] = 99 ; out of bounds
name[-1] = 99 ; ok
name[-5] = 99 ; ok
cx16.r0L = name[5]
cx16.r1L = name[6] ; out of bounds
cx16.r1L = name[-1] ; ok
cx16.r1L = name[-5] ; ok
array[5] = '!'
array[5] = 0
array[6] = 99 ; out of bounds
array[-1] = 99 ; ok
array[-5] = 99 ; ok
array[-6] = 99 ; ok
cx16.r0L = array[5]
cx16.r1L = array[6] ; out of bounds
cx16.r1L = array[-1] ; ok
cx16.r1L = array[-5] ; ok
cx16.r1L = array[-6] ; ok
const long buffer = 2000
const long bufferl = 999999
uword @shared addr = &buffer[2]
long @shared addr2 = &bufferl[2]
const long width = 100
uword @shared addr3 = &buffer[width]
long @shared addr4 = &bufferl[width]
}
}