Closed
Description
use std::hint::black_box;
static F: fn() -> bool = f as fn() -> bool;
static G: fn() -> bool = g as fn() -> bool;
pub fn f() -> bool {
F == G
}
pub fn g() -> bool {
F != G
}
fn main() {
assert_ne!(
black_box(f as fn() -> bool)(),
black_box(g as fn() -> bool)(),
"(F == G) != (F != G)",
);
}
$ rustc a.rs -O && ./a
thread 'main' panicked at a.rs:15:5:
assertion `left != right` failed: (F == G) != (F != G)
left: true
right: true
Meta
rustc --version --verbose
:
rustc 1.76.0-nightly (f704f3b93 2023-12-19)
binary: rustc
commit-hash: f704f3b93b1543cf504ecca0052f9f8531b1f61f
commit-date: 2023-12-19
host: x86_64-unknown-linux-gnu
release: 1.76.0-nightly
LLVM version: 17.0.6
Metadata
Metadata
Assignees
Labels
Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Category: This is a bug.Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessHigh priorityRelevant to the compiler team, which will review and decide on the PR/issue.Issue expected to be fixed by the next major LLVM upgrade, or backported fixes