Skip to content

ICE with SIGSEGV when compiling simple program with -C target-cpu=native on Broadwell #149965

@KrisTHL181

Description

@KrisTHL181

Note: The problem no longer occurs after removing target-cpu=native.

Code

fn main() { println!("Hello, world!"); }
// Yes I 100% sure this is no a joke!

Meta

rustc --version --verbose:

rustc 1.92.0 (ded5c06cf 2025-12-08)
binary: rustc
commit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234
commit-date: 2025-12-08
host: x86_64-unknown-linux-gnu
release: 1.92.0
LLVM version: 21.1.3

CPU info

Architecture:                x86_64
  CPU op-mode(s):            32-bit, 64-bit
  Address sizes:             39 bits physical, 48 bits virtual
  Byte Order:                Little Endian
CPU(s):                      4
  On-line CPU(s) list:       0-3
Vendor ID:                   GenuineIntel
  Model name:                Intel(R) Core(TM) i3-5005U CPU @ 2.00GHz
    CPU family:              6
    Model:                   61
    Thread(s) per core:      2
    Core(s) per socket:      2
    Socket(s):               1
    Stepping:                4
    CPU(s) scaling MHz:      100%
    CPU max MHz:             2000.0000
    CPU min MHz:             500.0000
    BogoMIPS:                3991.15
    Flags:                   fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb
                              rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx
                              est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer xsave avx f16c rdrand lahf_lm abm 3dnowpr
                             efetch cpuid_fault epb ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid r
                             dseed adx smap intel_pt xsaveopt dtherm ida arat pln pts vnmi md_clear flush_l1d
Virtualization features:     
  Virtualization:            VT-x
Caches (sum of all):         
  L1d:                       64 KiB (2 instances)
  L1i:                       64 KiB (2 instances)
  L2:                        512 KiB (2 instances)
  L3:                        3 MiB (1 instance)
NUMA:                        
  NUMA node(s):              1
  NUMA node0 CPU(s):         0-3
Vulnerabilities:             
  Gather data sampling:      Not affected
  Ghostwrite:                Not affected
  Indirect target selection: Not affected
  Itlb multihit:             KVM: Mitigation: VMX disabled
  L1tf:                      Mitigation; PTE Inversion; VMX vulnerable
  Mds:                       Vulnerable; SMT vulnerable
  Meltdown:                  Vulnerable
  Mmio stale data:           Not affected
  Old microcode:             Not affected
  Reg file data sampling:    Not affected
  Retbleed:                  Not affected
  Spec rstack overflow:      Not affected
  Spec store bypass:         Vulnerable
  Spectre v1:                Vulnerable: __user pointer sanitization and usercopy barriers only; no swapgs barriers
  Spectre v2:                Vulnerable; IBPB: disabled; STIBP: disabled; PBRSB-eIBRS: Not affected; BHI: Not affected
  Srbds:                     Vulnerable
  Tsa:                       Not affected
  Tsx async abort:           Not affected
  Vmscape:                   Vulnerable

Error output

(It still happens when the stack size is increased)

error: rustc interrupted by SIGSEGV, printing backtrace

/home/kris/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-d31eb41759495bb2.so(+0x3c04adf) [0x7f812d204adf]
/lib/x86_64-linux-gnu/libc.so.6(+0x3fdf0) [0x7f8129449df0]
/home/kris/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin/rustc(+0x12d62) [0x56280e178d62]
/home/kris/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-d31eb41759495bb2.so(_RNvNtCsbG23ezydE5t_18rustc_codegen_llvm9llvm_util20global_llvm_features+0x3fe) [0x7f812f9b937e]
/home/kris/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-d31eb41759495bb2.so(+0x63b6d7a) [0x7f812f9b6d7a]
/home/kris/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-d31eb41759495bb2.so(_RNvXs3_CsbG23ezydE5t_18rustc_codegen_llvmNtB5_18LlvmCodegenBackendNtNtNtCskkDJNHb7lVI_17rustc_codegen_ssa6traits7backend14CodegenBackend13target_config+0x26) [0x7f812f9b55e6]
/home/kris/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-d31eb41759495bb2.so(_RNvNtCs5jXuXMnic4K_15rustc_interface4util17add_configuration+0x25) [0x7f812fb41225]
/home/kris/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-d31eb41759495bb2.so(+0x6593b0d) [0x7f812fb93b0d]
/home/kris/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-d31eb41759495bb2.so(+0x614a300) [0x7f812f74a300]
/home/kris/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-d31eb41759495bb2.so(+0x6149fe4) [0x7f812f749fe4]
/home/kris/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/librustc_driver-d31eb41759495bb2.so(+0x614896f) [0x7f812f74896f]
/lib/x86_64-linux-gnu/libc.so.6(+0x92b7b) [0x7f812949cb7b]
/lib/x86_64-linux-gnu/libc.so.6(+0x1107b8) [0x7f812951a7b8]

note: we would appreciate a report at https://github.com/rust-lang/rust
help: you can increase rustc's stack size by setting RUST_MIN_STACK=16777216
zsh: segmentation fault (core dumped)  rustc -C opt-level=3 -C target-cpu=native -O a.rs -o digit_freq
--
Kernel log:
[52400.478510] rustc[421648]: segfault at 1d3180 ip 000055d8e0e5ed62 sp 00007f72fbbcf040 error 4 in rustc[11d62,55d8e0e5e000+7b000] likely on CPU 2 (core 1, socket 0)
[52400.478533] Code: 00 48 8b ac 0b b0 01 00 00 4c 39 f5 0f 85 92 06 00 00 4d 8b 67 08 89 f8 c1 e8 09 25 f8 ff 1f 00 4c 01 e0 4c 8d b3 58 03 00 00 <48> 8b 08 48 89 c8 48 c1 e8 30 48 8d 2d cd a6 28 00 4c 8b 6c c5 00
Backtrace

(note: it didn't change anything; the output was the same as before)

<backtrace>

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions