Open
Description
Hi, when we compile nested function calls with arguments, such as the following,
int f(int a, int b){
return a + b ;
}
int g(int a) {
return a;
}
int fmain(){
int a = 1;
int b = 2;
return f(g(a), b);
}
we get uncaught target signal 11 (segmentation fault) - core dumped when we run it in QEMU. However, the same code can be run without issues in MARS. Additionally, the code without the argument like below compiled to run fine.
int f(int a, int b){
return a + b ;
}
int g() {
return 1;
}
int fmain(){
int a = 1;
int b = 2;
return f(g(), b);
}
For the record, we have tried to both use the argument registers $a0-$a3, as well as direct storage in memory for the arguments.
We were wondering if there were any similar known issues, as we are very confused about why the compiled MIPS code could output the correct value in MARS but not QEMU. Thanks in advance!
Metadata
Metadata
Assignees
Labels
No labels