mirror of
https://github.com/irmen/prog8.git
synced 2024-12-25 23:29:55 +00:00
fix bug where non-inlined asmsub didn't always get a proper RTS, causing program crash
was caused by a change in 7.8; 8ae3bad6f7
"fix rts in empty asmsub"
This commit is contained in:
parent
2812736ae5
commit
094ecceaac
@ -118,7 +118,7 @@ internal class BeforeAsmAstChanger(val program: Program,
|
|||||||
|
|
||||||
// add the implicit return statement at the end (if it's not there yet), but only if it's not a kernal routine.
|
// add the implicit return statement at the end (if it's not there yet), but only if it's not a kernal routine.
|
||||||
// and if an assembly block doesn't contain a rts/rti, and some other situations.
|
// and if an assembly block doesn't contain a rts/rti, and some other situations.
|
||||||
if (!subroutine.isAsmSubroutine && !subroutine.inline) {
|
if (!subroutine.isAsmSubroutine && (!subroutine.inline || !options.optimize)) {
|
||||||
if(subroutine.statements.isEmpty() ||
|
if(subroutine.statements.isEmpty() ||
|
||||||
(subroutine.amountOfRtsInAsm() == 0
|
(subroutine.amountOfRtsInAsm() == 0
|
||||||
&& subroutine.statements.lastOrNull { it !is VarDecl } !is Return
|
&& subroutine.statements.lastOrNull { it !is VarDecl } !is Return
|
||||||
@ -145,7 +145,7 @@ internal class BeforeAsmAstChanger(val program: Program,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!subroutine.inline) {
|
if (!subroutine.inline || !options.optimize) {
|
||||||
if (subroutine.isAsmSubroutine && subroutine.asmAddress==null && subroutine.amountOfRtsInAsm() == 0) {
|
if (subroutine.isAsmSubroutine && subroutine.asmAddress==null && subroutine.amountOfRtsInAsm() == 0) {
|
||||||
// make sure the NOT INLINED asm subroutine actually has a rts at the end
|
// make sure the NOT INLINED asm subroutine actually has a rts at the end
|
||||||
// (non-asm routines get a Return statement as needed, above)
|
// (non-asm routines get a Return statement as needed, above)
|
||||||
|
@ -3,9 +3,6 @@ TODO
|
|||||||
|
|
||||||
For next release
|
For next release
|
||||||
^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^
|
||||||
FIX BUG:
|
|
||||||
- wormfood noopt crash caused by a change in 7.8; 8ae3bad6f7e73a3913594a983939298b357c7e7e "fix rts in empty asmsub"
|
|
||||||
|
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user