Thank you for your response. I disassembled the executable using objdump -d, and AI tools indicated that the issue arises because intermediate results are overwritten by parameter preparation during nested function calls.
And in arm64-gen.c gfunc_call(), lack of code for saving intermediate results to stack. kbkp...@sina.com From: Michael Ackermann via Tinycc-devel Date: 2025-05-17 15:45 To: tinycc-devel CC: Michael Ackermann Subject: [Tinycc-devel] not-reproducible with x86 or aarch32 - Re: [linux/aarch64] fn call bug when one arg is a struct fyi, seems aarch64-specific. got no aarch64 test-setup currently. arm-tcc, and i386-tcc showed no problems with this test case here. On 2025-05-17 14:45, kbkp...@sina.com wrote: > Under Linux/aarch64, when execute a function call with one arg is a > struct, it pass wrong arg to the function call. > > a test code: > > mmm.c > > ```c > > #include <stdio.h> > struct vec { > float x; > float y; > }; > void bug(float y, float x) { > printf("x=%f\ny=%f\n",x,y); > } > float dot(struct vec v) { > return 10.0; > } > void main() { > struct vec a; > a.x = 2.0; > a.y = 0.0; > bug(dot(a), dot(a)); > } > > ``` > > The correct result is : > > ``` > > x=10.000000 > y=10.000000 > > ``` > > But linux/aarch64 tcc output a wrong result: > > ``` > > x=10.000000 > > y=2.000000 > > ``` > __________________________________________________________________ > > kbkp...@sina.com > _______________________________________________ > Tinycc-devel mailing list > Tinycc-devel@nongnu.org > https://lists.nongnu.org/mailman/listinfo/tinycc-devel _______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel