Skip to content

ICE libgccjit.so: error: : unterminated block (-Zmir-preserve-ub) #881

@matthiaskrgr

Description

@matthiaskrgr

snippet:

//@compile-flags: -Zcodegen-backend=gcc -Clink-dead-code=true -Zmir-preserve-ub
const LOW_RANGE: char = '0';
const HIGH_RANGE: char = '9';

fn main() {
    match '5' {
        LOW_RANGE..=HIGH_RANGE => (),
        _ => (),
    };
}

Version information

rustc 1.97.0-nightly (f53b654a8 2026-04-30)
binary: rustc
commit-hash: f53b654a8882fd5fc036c4ca7a4ff41ce32497a6
commit-date: 2026-04-30
host: x86_64-unknown-linux-gnu
release: 1.97.0-nightly
LLVM version: 22.1.4

Command:
/home/matthias/.rustup/toolchains/master/bin/rustc -Zcodegen-backend=gcc -Clink-dead-code=true -Zmir-preserve-ub

Program output

libgccjit.so: error: : gcc_jit_block_end_with_switch: expr: (__uint32_t  __attribute__((aligned(4))))(__uint32_t  __attribute__((aligned(4))))(__int32_t  __attribute__((aligned(4))))53 <= (__uint32_t  __attribute__((aligned(4))))(__uint32_t  __attribute__((aligned(4))))(__int32_t  __attribute__((aligned(4))))57 (type: bool) is not of integer type
libgccjit.so: error: : unterminated block in _RNvCs5Oe9U7VPi96_4mvce4main: bb1
error: linking with `cc` failed: exit status: 1
  |
  = note:  "cc" "-m64" "/tmp/icemaker_global_tempdir.r7xD27Zz1GAO/rustc_testrunner_tmpdir_reporting.jt7Ecpyc2vaT/rustcyJOnmm/symbols.o" "<2 object files omitted>" "-Wl,--as-needed" "-Wl,-Bstatic" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib/{libstd-*,libpanic_unwind-*,libobject-*,libmemchr-*,libaddr2line-*,libgimli-*,libcfg_if-*,librustc_demangle-*,libstd_detect-*,libhashbrown-*,librustc_std_workspace_alloc-*,libminiz_oxide-*,libadler2-*,libunwind-*,liblibc-*,librustc_std_workspace_core-*,liballoc-*,libcore-*,libcompiler_builtins-*}.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-L" "/tmp/icemaker_global_tempdir.r7xD27Zz1GAO/rustc_testrunner_tmpdir_reporting.jt7Ecpyc2vaT/rustcyJOnmm/raw-dylibs" "-B<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/bin/gcc-ld" "-fuse-ld=lld" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "<sysroot>/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "outputfile" "-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
  = note: some arguments are omitted. use `--verbose` to show all linker arguments
  = note: rust-lld: error: cannot open outputfile.mvce.43ac9ae409ec8616-cgu.0.rcgu.o: No such file or directory
          collect2: error: ld returned 1 exit status
          

error: aborting due to 1 previous error


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