Closed
Description
The following programs produce a binary that will either segfault or produce a nonsense value seemingly depending on whether optimizations are enabled or not.
fn main() {
const FOO: u32 = 0 - 1;
println!("{}", FOO);
}
fn main() {
println!("{}", 0u32 - 1);
}
On 1.25.0 they behave as expected (the first doesn't even compile) but 1.26.0 and newer are broken.
Metadata
Metadata
Assignees
Labels
Area: Constant evaluation, covers all const contexts (static, const fn, ...)Category: This is a bug.Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.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.Performance or correctness regression from one stable version to another.