forked from M-Labs/nac3
David Mak
31dcd2dde9
In LLVM, i1 represents a 1-byte integer with a single valid bit; The rest of the 7 upper bits are undefined. This causes problems when using these variables in memory operations (e.g. memcpy/memmove as needed by List slicing and assignment). We fix this by treating all local boolean variables as i8 so that they are well-defined for memory operations. Function ABIs will continue to use i1, as memory operations cannot be directly performed on function arguments or return types, instead they are always converted back into local boolean variables (which are i8s anyways). Fixes #315.
18 lines
266 B
Python
18 lines
266 B
Python
@extern
|
|
def output_int32(x: int32):
|
|
...
|
|
|
|
@extern
|
|
def output_int32_list(x: list[int32]):
|
|
...
|
|
|
|
def run() -> int32:
|
|
bl = [True, False]
|
|
|
|
bl1 = bl[:]
|
|
bl1[1:] = [True]
|
|
output_int32_list([int32(b) for b in bl1])
|
|
output_int32_list([int32(b) for b in bl1])
|
|
|
|
return 0
|