mirror of
https://github.com/irmen/prog8.git
synced 2025-01-23 00:31:14 +00:00
fix codegen crash on certain nested typecast
This commit is contained in:
parent
35af53828a
commit
2d600da8b6
@ -738,10 +738,10 @@ internal class AssignmentAsmGen(private val program: Program,
|
||||
return
|
||||
}
|
||||
|
||||
if(origTypeCastExpression.type == DataType.UBYTE) {
|
||||
if(valueDt in WordDatatypes && origTypeCastExpression.type == DataType.UBYTE) {
|
||||
val parentTc = origTypeCastExpression.parent as? TypecastExpression
|
||||
if(parentTc!=null && parentTc.type==DataType.UWORD) {
|
||||
// typecast something to ubyte and directly back to uword
|
||||
// typecast a word value to ubyte and directly back to uword
|
||||
// generate code for lsb(value) here instead of the ubyte typecast
|
||||
return assignCastViaLsbFunc(value, target)
|
||||
}
|
||||
|
@ -701,6 +701,7 @@ main {
|
||||
fl = bb as float
|
||||
bb = fl as byte
|
||||
uw = fl as uword
|
||||
uw = 8888 + (bb as ubyte)
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
@ -4,14 +4,9 @@
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
repeat {
|
||||
uword keys = cx16.kbdbuf_peek2()
|
||||
txt.print_uwhex(keys, true)
|
||||
if msb(keys) {
|
||||
c64.GETIN()
|
||||
}
|
||||
txt.nl()
|
||||
}
|
||||
byte tx = 1
|
||||
uword @shared zzzz= $2000 + (tx as ubyte)
|
||||
txt.print_uwhex(zzzz,true)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user