-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calling Convention not respected #32
Comments
How so? That's your last printf call, and it's targetting printf; compute doesn't clobber x12 |
Is it possible that x12 is overwritten by the printf itself? The address in x12 is calculated before the first printf, but it isn't recalculated before the subsequent call to printf, so x12 may contain invalid address if printf uses it. |
You're probably right yeah. If x12 is caller-saved, then main is failing to save it around the printf, and if it's callee-saved, then main is failing to save it. Not sure which version of the calling convention LLVM presently implements. |
I think it is the last calling convention of RISCV implemented in f4c04ee. In fact, x12 is caller-saved but it seems that the backend interprets it as callee-saved. I'm trying to figure out where is the error in the code, but I'm not an expert of LLVM, so it's quite difficult. |
I had the same problem. I don't know also why this branch (caller-saved-fix) was not merged with the riscv-trunk branch. |
Note, this repository does not have an active maintainer. |
I came here to find a solution for a bug which I found on dhrystone.
This lines were compiled to; (strcpy(dst, src) is converted to memcpy(dst, src, size))
The commit (ce8ac4e) fixed this issue.
This is a bad news... |
Hi! I think there is a problem in riscv-trunk when compiled with -O1 option. I attached an example in c and the generated assembly.
I compile with:
/.../clang -O1 -target riscv -mriscv=RV32I test.c -S -o test.S
/.../riscv32-unknown-elf-gcc test.S -o test.o
I think that the last jalr (line 42) jumps to a wrong address.
test.zip
The text was updated successfully, but these errors were encountered: