Skip to content

Conversation

@Fulgen301
Copy link
Contributor

@Fulgen301 Fulgen301 commented Dec 21, 2025

Inline assembly marked with options(noreturn) isn't actually annotated with LLVM's noreturn attribute, which can cause extra instructions to be generated:

pub fn foo() -> ! {
    unsafe { core::arch::asm!("int 0x29", options(noreturn)); }
}

currently generates

int 0x29
ud2

Other options are mapped to their respective LLVM attributes, so this seems like an oversight.

@rustbot
Copy link
Collaborator

rustbot commented Dec 21, 2025

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Dec 21, 2025
attrs.push(llvm::MemoryEffects::ReadOnlyNotPure.create_attr(self.cx.llcx));
}

if options.contains(InlineAsmOptions::NORETURN) {
Copy link
Member

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants