pawn icon indicating copy to clipboard operation
pawn copied to clipboard

size check of packed arrays broken on 64 bit cell size

Open namazso opened this issue 2 years ago • 1 comments

toupper_(v)
    return v >= 'a' && v <= 'z' ? v - 'a' + 'A' : v;

main() {
    new str{} = "aaaaaaaaaaaaaaa";
    for (new i = 0; i < sizeof(str) * (cellbits / charbits); ++i)
        str{i} = toupper_(str{i});
    return str{8};
}

when compiled with -C64 a BOUNDS 7 is inserted. with runtime checks disabled the program works as expected

namazso avatar Jul 31 '21 10:07 namazso

this bug is also present on 16 bits, there it generates a BOUNDS 31, which doesn't cause an early halt but is still incorrect

edit: https://github.com/compuphase/pawn/pull/69 should fix this

namazso avatar Jul 31 '21 17:07 namazso