On Fri, 2022-07-01 at 06:15 -0700, ken.dickey@whidbey.com wrote:
While I hate to call "compiler codegen bug", at this point I suspect a tool issue with gcc [Debian 10.2.1-6 2021-01-10].
I would like to try with an updated gcc and I probably need to craft a small example which either teaches me how to avoid the problem or can convince the compiler port/maintainers that there is a problem.
The code is "difficult to read" to put it mildly, but - after a cursory look at it - I believe the code generated by GCC is correct.
The function being called in
floatRet.d = dispatchFunctionPointerwithwithwithwithwithwithwithwith...
is declared to return a struct of size greater than 2*XLEN. so it is "returned" by reference passed to the callee as implicit first argument. Therefore, there is no need to "assign" to float.d after callee returns, it's already done (or, I should say, the compiler is free to assume that). This is exactly what I see in your asm output in one of your previous emails.
See RISC-V ELF psABI [1].
[1]: https://github.com/riscv-non-isa/riscv-elf-psabi-doc
HTH, Jan
Single stepping in gdb (stepi) just shows that the floatRet.d is not getting set to the result -- no code to do this.
As as aside, the AllWinner D1 works fine but is vvvvveeeeeeeerrrrrryyy ssllllloooooowww. So building and debugging takes patience.
The great news is that both Cuis and Squeak images run fine (unless you load compressed files, which yield CRC errors).
I do have some time tomorrow (Saturday; 2 July) in Pacific Time Zone, but I am not sure how we might proceed to trouble-shoot the problem.
It would be good to talk with you in any case.
Cheers, -KenD