-
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
SIGSEGV (invalid address) from LLVM in rustc with asm and #[naked] fn #77848
Comments
Please check again. There is a comma (,) after |
Even with that adjusted, it unfortunately still crashes with Looks like that asm alone works fine given the godbolt, but it doesn't work in the project. Maybe this is due to other unstable features used in it. |
The function contains the asm! snippet is here: But it is a naked function. Not a normal one. |
Indeed, that's intentional (I think... this code is very old and I'm just coming back to it now to update to latest rust version). Could that be causing it somehow? However, in godbolt adding |
I think that must be a key part of the issue. In the actual project, if I remove the |
Even though stack is different I think this is duplicate of #75922 |
That seems highly likely. If it is UB as is said in that thread it could be manifesting in different ways, leading to different stack traces. Apologies, I didn't see that issue. Shall I close? |
After making some modifications to a relatively complex project, I received a SIGSEGV from rustc:
Full backtrace from LLDB.
This originates in the compilation of the crate itself rather than any of its dependencies.
The crate is using quite a few unstable features in its .cargo/config, a custom target json, and the following unstable features:
asm, lang_items, allocator_api, alloc_error_handler, panic_info_message, abi_x86_interrupt, naked_functions
. However, it appears that the culprit is a particularly complexasm
block, as commenting it out makes it compile successfully:This occurs inside of a
#[naked]
function here. Removing#[naked]
causes the segfault to go away.I have no idea whether this asm block is actually correct, both in terms of macro invocation and assembly, but either way I would not expect a segfault.
Meta
rustc --version --verbose
:Backtrace
The text was updated successfully, but these errors were encountered: