Skip to content

ICE cannot add output operand to asm goto #835

@matthiaskrgr

Description

@matthiaskrgr

snippet:

//@compile-flags: -Zcodegen-backend=gcc --crate-type=lib
#![feature(asm_goto)]
#![feature(asm_goto_with_outputs)]

#[unsafe(no_mangle)]
pub fn asm_goto_test(
    mut a: i16,
) -> i16 {
    unsafe {
        std::arch::asm!(
            "jmp {op}",
            inout("eax") a,
            op = label { a = 7; },
            options(nostack,nomem)
        );
        a
    }
}

Version information

rustc 1.95.0-nightly (a18e6d9d1 2026-01-24)
binary: rustc
commit-hash: a18e6d9d1473d9b25581dd04bef6c7577999631c
commit-date: 2026-01-24
host: x86_64-unknown-linux-gnu
release: 1.95.0-nightly
LLVM version: 21.1.8

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcodegen-backend=gcc --crate-type=lib

Program output

warning: the feature `asm_goto` has been stable since 1.87.0 and no longer requires an attribute to enable
 --> /tmp/icemaker_global_tempdir.lcpVsHnynmjB/rustc_testrunner_tmpdir_reporting.gMlrdyrU24TL/mvce.rs:1:12
  |
1 | #![feature(asm_goto)]
  |            ^^^^^^^^
  |
  = note: `#[warn(stable_features)]` on by default

libgccjit.so: error: : gcc_jit_extended_asm_add_output_operand: cannot add output operand to asm goto
libgccjit.so: error: : gcc_jit_block_add_assignment: adding to terminated block: start (already terminated by: asm volatile goto ("jmp %l2" :  : "0" (loadedValue1) : "cc" : bb2 [fallthrough: bb3]))
error: failed to build archive at `outputfile`: failed to open object file: No such file or directory (os error 2)

error: aborting due to 1 previous error; 1 warning emitted


Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions