-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
Open
Labels
A-control-flow-integrityArea: Control Flow Integrity (CFI) security mitigationArea: Control Flow Integrity (CFI) security mitigationA-sanitizersArea: Sanitizers for correctness and code qualityArea: Sanitizers for correctness and code qualityC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: 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.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.PG-exploit-mitigationsProject group: Exploit mitigationsProject group: Exploit mitigationsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant 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 wayThis issue requires a build of rustc or tooling with debug-assertions in some way
Description
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!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-control-flow-integrityArea: Control Flow Integrity (CFI) security mitigationArea: Control Flow Integrity (CFI) security mitigationA-sanitizersArea: Sanitizers for correctness and code qualityArea: Sanitizers for correctness and code qualityC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: 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.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.PG-exploit-mitigationsProject group: Exploit mitigationsProject group: Exploit mitigationsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant 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 wayThis issue requires a build of rustc or tooling with debug-assertions in some way