-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Incorrect reporting of asm labels in Nightly #128659
Comments
Changing the labels in the assembly fixes the problem. I believe the problem is with the compiler indicating the push si
mov si, {packet:x}
mov ax, 0x4200
int 0x13 ;<-- not error, but reported
jc 1f ;<-- actual error line
mov {status:x}, 0 ;<-- not error, but reported
jmp 2f
1: ;<-- actual error line
mov {status:x}, 1
2:
pop si Maybe misalignment in asm macro's error reporting? |
Thanks for reporting this! Yes, this is a recent lint since #126922 and seems to have a few bugs, which is expected since we uhhh don't usually lint on assembly code, but rather on Rust code. ^^; |
also cc @tgross35 since you've done some work on this lint too. |
Thanks for the response! I didn't catch that this is the same issue as #126922. I figured it had to do with the weird target and some weird spans in the asm macro being confused. If it means anything, this is a really non-standard target as well: |
Ah interesting. Seems like this needs to check more than just the first character rust/compiler/rustc_lint/src/builtin.rs Line 2887 in ab1527f
|
That shouldn't matter as it is still an x86 target, right? And thus still uses x86 assembly which will thus be parsed by LLVM's x86 assembly parser. |
@rustbot claim The code that finds the span for the label assumes that the first occurrence of the label within the string literal is the start of the label. In this case it correctly finds the |
The problem boils down to "turn a range of offsets in a string literal into a span in the source code", but it's not as simple as some offset math because escapes exist, so when processing, for example |
Updating from 1.80.x-nightly to 1.82.x-nightly introduced a new compiler error in one of my inline assembly blocks falsely reporting that an
int 0x13
shouldn't include numerical labels.I tried this code:
Compiler output:
Meta
rustc --version --verbose
:No backtrace was provided even when setting RUST_BACKTRACE=1
The text was updated successfully, but these errors were encountered: