Skip to content
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

Potential GP_REG t6 (x31) prologue/epilogue save to stack issue in pulp-riscv-gcc/gcc/config/riscv/riscv.c #32

Open
JamInJar opened this issue Aug 28, 2021 · 0 comments

Comments

@JamInJar
Copy link

Hi,
There might be a minor issue related to prologue and epilogue GP registers saving:

Context

I was trying to remove the limitation related to the ISRs regarding functions calls, that is to say allowing such calls at my own risk. I reasoned that I should save all caller-saved regs instead on simply the ones used by the ISR. I managed to do so but was a bit puzzled as t6 (x31) did not appear as part of the regs saved to the stack during my ISR prologue (and respectively retrieved from it during the epilogue).

Issue

I found at lines 4233 (riscv_for_each_saved_reg), 4365 (riscv_adjust_lib_call_cfi_prologue) and 4506 (riscv_adjust_lib_call_cfi_epilogue) a "for" loop that might contain a typo:
for (int regno = GP_REG_FIRST; regno <= GP_REG_LAST-1; regno++)

Trial

I did not know if it was done purposefully but anyway made the following modification:
for (int regno = GP_REG_FIRST; regno <= GP_REG_LAST; regno++)
This time t6 was saved on the stack.

Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant