Skip to content

llvm error: cfi: Assertion cast<DISubprogram>(Scope)->describes(&MF->getFunction())` #119951

@matthiaskrgr

Description

@matthiaskrgr

snippet:

use std::sync::atomic::Ordering::*;
use std::sync::atomic::{fence, AtomicUsize};
use std::thread::spawn;

fn static_atomic(val: usize) -> &'static AtomicUsize {
    let ret = Box::leak(Box::new(AtomicUsize::new(val)));
    ret
}

fn relaxed() -> bool {
    let x = static_atomic(0);

    let j2 = spawn(move || x.load(Relaxed));

    let r2 = j2.join().unwrap();

    r2 == 1
}

fn seq_cst() -> bool {
    let x = static_atomic(0);

    let j3 = spawn(move || x.load(SeqCst));

    let r3 = j3.join().unwrap();

    r3 == 1
}

fn initialization_write(add_fence: bool) -> bool {
    let x = static_atomic(11);

    let j2 = spawn(move || x.load(Relaxed));

    let r2 = j2.join().unwrap();

    r2 == 11
}

fn assert_once(f: fn() -> bool) {
    assert!(std::iter::repeat_with(|| f()).take(100).any(|x| x));
}

pub fn main() {
    assert_once(relaxed);
    assert_once(seq_cst);
    assert_once(|| initialization_write(false));
}

Version information

rustc 1.77.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.77.0-dev
LLVM version: 17.0.6

Command:
/home/matthias/.rustup/toolchains/local-debug-assertions/bin/rustc -Zmir-opt-level=3 -Cdebuginfo=2 -Copt-level=3 -Zsanitizer=cfi -Ccodegen-units=1 -Clto -ocodegen -Zsanitizer-cfi-normalize-integers --edition=2015

Program output

warning: unused import: `fence`
 --> /tmp/icemaker_global_tempdir.18GTkKSaGL4b/rustc_testrunner_tmpdir_reporting.PLKsBwe60BMh/mvce.rs:2:25
  |
2 | use std::sync::atomic::{fence, AtomicUsize};
  |                         ^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

warning: unused variable: `add_fence`
  --> /tmp/icemaker_global_tempdir.18GTkKSaGL4b/rustc_testrunner_tmpdir_reporting.PLKsBwe60BMh/mvce.rs:30:25
   |
30 | fn initialization_write(add_fence: bool) -> bool {
   |                         ^^^^^^^^^ help: if this is intentional, prefix it with an underscore: `_add_fence`
   |
   = note: `#[warn(unused_variables)]` on by default

inlinable function call in a function with debug info must have a !dbg location
  %34 = tail call noundef zeroext i1 @_ZN4core3ops8function6FnOnce9call_once17h0a5cef41d9043f5eE(), !noalias !6817
inlinable function call in a function with debug info must have a !dbg location
  %34 = tail call noundef zeroext i1 @_ZN4core3ops8function6FnOnce9call_once17h0a5cef41d9043f5eE(), !noalias !6816
LLVM ERROR: Broken module found, compilation aborted!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-control-flow-integrityArea: Control Flow Integrity (CFI) security mitigationA-sanitizersArea: Sanitizers for correctness and code qualityC-bugCategory: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.PG-exploit-mitigationsProject group: Exploit mitigationsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-debug-assertionsThis issue requires a build of rustc or tooling with debug-assertions in some way

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions