mirror of
https://github.com/irmen/prog8.git
synced 2025-08-09 19:25:22 +00:00
fixed compiler recursion crash when returning certain typecasted value
This commit is contained in:
@@ -609,6 +609,11 @@ $containsLabel lda #1
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(target.kind==TargetStorageKind.REGISTER) {
|
||||||
|
assignExpressionToRegister(value, target.register!!, targetDt==DataType.BYTE || targetDt==DataType.WORD)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if(targetDt==DataType.FLOAT && (target.register==RegisterOrPair.FAC1 || target.register==RegisterOrPair.FAC2)) {
|
if(targetDt==DataType.FLOAT && (target.register==RegisterOrPair.FAC1 || target.register==RegisterOrPair.FAC2)) {
|
||||||
when(valueDt) {
|
when(valueDt) {
|
||||||
DataType.UBYTE -> {
|
DataType.UBYTE -> {
|
||||||
|
@@ -1 +1 @@
|
|||||||
7.8-dev
|
7.7.1
|
||||||
|
@@ -185,4 +185,19 @@ class TestTypecasts: FunSpec({
|
|||||||
val statements = result.program.entrypoint.statements
|
val statements = result.program.entrypoint.statements
|
||||||
statements.size shouldBe 16
|
statements.size shouldBe 16
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test("no infinite typecast loop in assignment asmgen") {
|
||||||
|
val text = """
|
||||||
|
main {
|
||||||
|
sub start() {
|
||||||
|
word @shared qq = calculate(33)
|
||||||
|
}
|
||||||
|
|
||||||
|
sub calculate(ubyte row) -> word {
|
||||||
|
return (8-(row as byte))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
compileText(C64Target, false, text, writeAssembly = true).assertSuccess()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
@@ -3,17 +3,7 @@ TODO
|
|||||||
|
|
||||||
For next release
|
For next release
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
- BUGFIX RELEASE: Fix compiler stack overflow crash:
|
...
|
||||||
sub sprite_y_for_row(ubyte row) -> word {
|
|
||||||
return (8-row as byte)
|
|
||||||
}
|
|
||||||
|
|
||||||
- move vload() to cx16diskio module
|
|
||||||
- nameInAssemblyCode() should search smarter
|
|
||||||
- if char in "string" should fall back to string.find if string is longer than... 12?
|
|
||||||
also.. is "string" removed from the interned strings?
|
|
||||||
- add option to memory() to get aligned memory block (word, page aligned)
|
|
||||||
|
|
||||||
|
|
||||||
Need help with
|
Need help with
|
||||||
^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^
|
||||||
@@ -30,6 +20,16 @@ Blocked by an official Commander-x16 r39 release
|
|||||||
|
|
||||||
Future Things and Ideas
|
Future Things and Ideas
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
- why does this use stack eval on return:
|
||||||
|
sub sprite_y_for_row(ubyte row) -> word {
|
||||||
|
return (8-row as byte)
|
||||||
|
}
|
||||||
|
- move vload() to cx16diskio module
|
||||||
|
- nameInAssemblyCode() should search smarter
|
||||||
|
- if char in "string" should fall back to string.find if string is longer than... 16?
|
||||||
|
also.. is "string" removed from the interned strings?
|
||||||
|
- add option to memory() to get aligned memory block (word, page aligned)
|
||||||
|
- Typecastexpression.isSimple: make it 'expression.isSimple' rather than always false. (this breaks some things atm)
|
||||||
- IdentifierReference: fix equality to also include position. CallGraph can then also only store IdentifierRef instead of pair(ident, position) as keys.
|
- IdentifierReference: fix equality to also include position. CallGraph can then also only store IdentifierRef instead of pair(ident, position) as keys.
|
||||||
- Fix: don't report as recursion if code assign address of its own subroutine to something, rather than calling it
|
- Fix: don't report as recursion if code assign address of its own subroutine to something, rather than calling it
|
||||||
- allow "xxx" * constexpr (where constexpr is not a number literal, now gives expression error not same type)
|
- allow "xxx" * constexpr (where constexpr is not a number literal, now gives expression error not same type)
|
||||||
|
@@ -2,12 +2,20 @@
|
|||||||
%zeropage basicsafe
|
%zeropage basicsafe
|
||||||
|
|
||||||
main {
|
main {
|
||||||
|
|
||||||
sub start() {
|
sub start() {
|
||||||
byte[3] @shared sprites_x = values
|
word ww
|
||||||
|
ww = calculate(6)
|
||||||
|
txt.print_w(ww)
|
||||||
|
txt.nl()
|
||||||
|
ww = calculate(8)
|
||||||
|
txt.print_w(ww)
|
||||||
|
txt.nl()
|
||||||
|
ww = calculate(10)
|
||||||
|
txt.print_w(ww)
|
||||||
|
txt.nl()
|
||||||
}
|
}
|
||||||
|
|
||||||
byte[3] values = [1,2,3]
|
sub calculate(ubyte row) -> word {
|
||||||
|
return 8-(row as byte)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user