mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2025-01-10 12:30:03 +00:00
Fix bug causing functions with 254 bytes of locals to crash on return.
This was a bug with the code for moving the return address. It would generate a "LDA 0" instruction when it was trying to load the value at DP+256. The following program (derived from a csmith-generated test case) demonstrates the crash: #pragma optimize 8 int main (int argc, char **argv) { char s[0xFC]; }
This commit is contained in:
parent
21493271b9
commit
29de867039
2
Gen.pas
2
Gen.pas
@ -5091,7 +5091,7 @@ procedure GenTree {op: icptr};
|
|||||||
{if anything needs to be removed from the stack, move the return val}
|
{if anything needs to be removed from the stack, move the return val}
|
||||||
size := localSize + parameterSize;
|
size := localSize + parameterSize;
|
||||||
if parameterSize <> 0 then begin
|
if parameterSize <> 0 then begin
|
||||||
if localSize > 254 then begin
|
if localSize > 253 then begin
|
||||||
GenNative(m_ldx_imm, immediate, localSize+1, nil, 0);
|
GenNative(m_ldx_imm, immediate, localSize+1, nil, 0);
|
||||||
GenNative(m_lda_dirx, direct, 0, nil, 0);
|
GenNative(m_lda_dirx, direct, 0, nil, 0);
|
||||||
GenNative(m_ldy_dirx, direct, 1, nil, 0);
|
GenNative(m_ldy_dirx, direct, 1, nil, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user