Open
Description
Issue description:
Using the forward [n]funcname(args);
syntax causes the compiler to generate the wrong code.
Minimal complete verifiable example (MCVE):
forward [4]f();
f() {
new x[4];
return x;
}
main () {
new arr[4];
arr = f();
}
generates
proc ; f
stack fffffff0
zero.pri
addr.alt fffffff0
fill 10
addr.pri fffffff0
const.alt 0
movs 10
stack 10
retn
proc ; main
stack fffffff0
zero.pri
addr.alt fffffff0
fill 10
addr.pri fffffff0
push.pri
heap 10
push.alt
push.c 0
call .f
pop.pri
pop.alt
movs 10
heap fffffff0
stack 10
zero.pri
retn
The array is not returned correctly. It instead corrupts the memory by writing to 0
.
It should have instead been load.s.alt 12
.
Workspace Information:
- Compiler version:
- Command line arguments provided (or sampctl version):
- Operating System: