Closed
Description
I tried this code:
enum Pass {
Opaque {
clear_color: [f32; 4],
with_depth_pre_pass: bool,
},
Transparent,
}
enum LoadOp {
Clear,
Load,
}
#[inline(never)]
fn check(x: Option<LoadOp>) {
assert!(x.is_none());
}
#[inline(never)]
fn test(mode: Pass) {
check(match mode {
Pass::Opaque {
with_depth_pre_pass: true,
..
}
| Pass::Transparent => None,
_ => Some(LoadOp::Clear),
});
}
fn main() {
println!("Hello, world!");
test(Pass::Transparent);
}
The assertion shouldn't fail, because pass
is Pass::Transparent
and so the parameter to the function check
should be None
, but the assertion still fails.
Meta
rustc --version --verbose
:
rustc 1.73.0-nightly (08d00b40a 2023-08-09)
binary: rustc
commit-hash: 08d00b40aef2017fe6dba3ff7d6476efa0c10888
commit-date: 2023-08-09
host: x86_64-unknown-linux-gnu
release: 1.73.0-nightly
LLVM version: 17.0.0
It seems that the bug only occurs when using opt-level=1
or opt-level=2
and after updating to LLVM 17.
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/SoundnessCritical priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from stable to nightly.