fixed compiler crash: unsigned = (-(unsigned as word) as uword)

This commit is contained in:
Irmen de Jong
2022-11-27 16:50:44 +01:00
parent db55562f6a
commit ec64a68a71
5 changed files with 46 additions and 6 deletions

View File

@@ -63,5 +63,21 @@ class TestVariables: FunSpec({
"""
compileText(C64Target(), false, text, writeAssembly = true) shouldNotBe null
}
test("negation of unsigned via casts") {
val text = """
main {
sub start() {
cx16.r0L = -(cx16.r0L as byte) as ubyte
cx16.r0 = -(cx16.r0 as word) as uword
ubyte ub
uword uw
ub = -(ub as byte) as ubyte
uw = -(uw as word) as uword
}
}
"""
compileText(C64Target(), false, text, writeAssembly = true) shouldNotBe null
}
})