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

riscv64: Fix encoding for c.addi4spn #7208

Merged
merged 2 commits into from
Oct 11, 2023

Conversation

afonso360
Copy link
Contributor

👋 Hey,

I was running fuzzgen on riscv when it crashed with an illegal instruction. When generating large stack offsets, we can use the compressed instruction c.addi4spn, It has a range of {4,1020} bytes. However we were accidentally not encoding the MSB on the immediate field.

This meant that the instruction would be encoded with an offset of 0, which is illegal for this instruction. The fix here is to ensure that the MSB bit is encoded correctly.

@afonso360 afonso360 added the cranelift:area:riscv64 Issues related to the RISC-V 64 backend. label Oct 10, 2023
@afonso360 afonso360 requested a review from a team as a code owner October 10, 2023 14:57
@afonso360 afonso360 requested review from fitzgen and removed request for a team October 10, 2023 14:57
@github-actions github-actions bot added the cranelift Issues related to the Cranelift code generator label Oct 10, 2023
Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@fitzgen fitzgen added this pull request to the merge queue Oct 11, 2023
Merged via the queue into bytecodealliance:main with commit 2d44ecc Oct 11, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cranelift:area:riscv64 Issues related to the RISC-V 64 backend. cranelift Issues related to the Cranelift code generator
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants