Compiler: Fix runtime error in variadic functions that return strings.

Imported from SM-AM: 1d1244c2f0.

"This fixes a bug where returning a string from a variadic function caused
an invalid memory access error during runtime. It seems like they forgot
to update existing string return code for variadic functions."
This commit is contained in:
Arkshine
2014-08-15 17:15:22 +02:00
parent 1866afd80b
commit 17114347d1
3 changed files with 53 additions and 1 deletions

View File

@@ -410,6 +410,16 @@ SC_FUNC void rvalue(value *lval)
} /* if */
}
/* dereference
*
* Get a cell from a memory address stored in the primary register
*/
SC_FUNC void dereference(void)
{
stgwrite("\tload.i\n");
code_idx+=opcodes(1);
}
/* Get the address of a symbol into the primary or alternate register (used
* for arrays, and for passing arguments by reference).
*/
@@ -829,6 +839,18 @@ SC_FUNC void defstorage(void)
stgwrite("dump ");
}
/*
* Copies frame address to primary register
*/
SC_FUNC void getfrm(void)
{
stgwrite("\tlctrl 5\n");
code_idx+=opcodes(1)+opargs(1);
}
/*
/*
* Inclrement/decrement stack pointer. Note that this routine does
* nothing if the delta is zero.