Skip to content

thumbv6m-none-eabi inline asm clobber_abi("C") fails with register 'LR' allocated for constraint '{r14}' does not match required type #163173

Closed

Description

@kevinmehall

The following minimized example fails to compile on the latest nightly, but works on stable and the previous nightly:

#![no_std]

#[no_mangle]
pub fn test() {
    unsafe { core::arch::asm!("nop", clobber_abi("C")) }
}

#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! {
    loop {}
}

Current nightly:

❯ rustc +nightly-2026-09-22 --version
rustc 1.100.0-nightly (1303417c4 2026-09-21)
                                                                                                                                                                                      
❯ rustc +nightly-2026-09-22 --target thumbv6m-none-eabi --crate-type staticlib -o repro.a repro.rs
error: register 'LR' allocated for constraint '{r14}' does not match required type
 --> repro.rs:6:32
  |
6 |     unsafe { core::arch::asm!("nop", clobber_abi("C")) }
  |                                ^^^

error: aborting due to 1 previous error

Prior nightly:

❯ rustc +nightly-2026-09-21 --version                                                             
rustc 1.100.0-nightly (bba531001 2026-09-20)

❯ rustc +nightly-2026-09-21 --target thumbv6m-none-eabi --crate-type staticlib -o repro.a repro.rs

Stable:

❯ rustc +stable --version                                                             
rustc 1.98.1 (48a229cea 2026-09-01)
                                                                                                                                                                                          
❯ rustc +stable --target thumbv6m-none-eabi --crate-type staticlib -o repro.a repro.rs

This can also be reproduced with the examples of embassy-rp and zeptos, and likely anything that calls into the RP2040 boot ROM for flash operations.

Activity

  1. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 22, 2026
  2. zachs18 commented on Sep 23, 2026

    @zachs18
    Contributor

    searched nightlies: from nightly-2026-09-21 to nightly-2026-09-23
    regressed nightly: nightly-2026-09-22
    searched commit range: bba5310...1303417
    regressed commit: f45772e

    bisected with cargo-bisect-rustc v0.6.11

    Host triple: x86_64-unknown-linux-gnu
    Reproduce with:

    cargo bisect-rustc --preserve --with-src --without-cargo -- b --target thumbv6m-none-eabi -Zbuild-std 

    Currently testing with rust-lang/cargo-bisect-rustc#438 to check which PR in the rollup #163095 may have caused the regression. #163062 seems likely.

    Edit: Yes, cargo-bisect-rustc said dbcd41d (edit 2: and Reverting 3de0624 seems to fix the regression), so seems like #163062 caused the regression. CC @malezjaa @folkertdev

  3. malezjaa commented on Sep 23, 2026

    @malezjaa
    Contributor

    Well for now, I think we can revert the ARM r14 change and keep the AArch64 x30 change. That should fix the regression. I can look for a proper fix for {r14} later today.

  4. folkertdev commented on Sep 23, 2026

    @folkertdev
    Contributor

    Hmm yeah, {r14} works for arm but not for thumb, I think that needs further LLVM changes.

    Can you revert the arm part and add a test for thumb (that would have caught this regression)?

  5. added a commit that references this issue on Sep 23, 2026
    b398101
  6. added a commit that references this issue on Sep 24, 2026
    c092ef0
  7. removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Sep 24, 2026
  8. added a commit that references this issue on Sep 24, 2026
    e7dcfb0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions