-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
AVR asm doesn't validate ldd
operands
#62012
Labels
Comments
fixed by https://reviews.llvm.org/D147877 However you need to use |
Thank you! If we need to wrangle LLVM a bit to get full error messaging, that's okay, it's nice enough to not need to compile LLVM with full assertions to do so. |
fixed in 6e57f68, please try to build llvm with the newest main branch. |
gysit
pushed a commit
to nextsilicon/llvm-project
that referenced
this issue
Apr 27, 2023
We should reject "ldd Rn, X" with explicit error message rather than "llvm_unreachable" in llvm's release build. Fixes llvm#62012 Reviewed By: Miss_Grape Differential Revision: https://reviews.llvm.org/D147877
flemairen6
pushed a commit
to Xilinx/llvm-project
that referenced
this issue
May 10, 2023
We should reject "ldd Rn, X" with explicit error message rather than "llvm_unreachable" in llvm's release build. Fixes llvm#62012 Reviewed By: Miss_Grape Differential Revision: https://reviews.llvm.org/D147877
veselypeta
pushed a commit
to veselypeta/cherillvm
that referenced
this issue
Aug 21, 2024
We should reject "ldd Rn, X" with explicit error message rather than "llvm_unreachable" in llvm's release build. Fixes llvm/llvm-project#62012 Reviewed By: Miss_Grape Differential Revision: https://reviews.llvm.org/D147877
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Consider the following LLVM IR program, derived from a Rust program featured in rust-lang/rust#109360 that misuses the
ldd
instruction on AVR:As I understand it,
ldd
only takes the Y or Z registers as its second operand (plus an offset). But this assembly is accepted without complaint, resulting in ill-formed assembly and peculiar binaries. This is what llc thinks the assembly is:But this is what comes out the other side of objdump:
The address is loaded into the r26 and r27 register (which are concatenated together as the "X" register), and then reads are done from Y (a valid target of ldd, at least), which does not contain the address that was loaded and thus the programmer's intent is lost.
Strictly speaking, there is no problem here. The assembly is incorrect, so feeding it into an assembler is arguably UB. However, observing that it is incorrect is also trivial, thus an assembler may wish to reject it. I don't know LLVM's policy here, but I notice
llvm-project/llvm/test/CodeGen/AVR/inline-asm/inline-asm-invalid.ll
does exist, so there's that.The text was updated successfully, but these errors were encountered: