Files
tinycc/tests/tests2/137_funcall_struct_args.c
kbkpbot 0c12363fd3 arm64: Save func results before struct args
In gfunc_call(), structure members are loaded into registers during
argument handling.
This operation may overwrite previous function call results stored in
registers (e.g., s0). To prevent this, we must save function call
results to the stack before processing structure arguments.
2025-07-11 22:13:30 +08:00

24 lines
396 B
C

#include <stdio.h>
// arm64-gen.c: gfunc_call() Second pass when struct args may overwrite previous func call result
struct vec {
float x;
float y;
};
void bug(float x, float y) {
printf("x=%f\ny=%f\n", x, y);
}
float dot(struct vec v) {
return 999.5;
}
void main(void) {
struct vec a;
a.x = 33.0f;
a.y = 77.0f;
bug(dot(a), dot(a));
}