- Notifications
You must be signed in to change notification settings - Fork 13.9k
Open
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.I-miscompileIssue: Correct Rust code lowers to incorrect machine codeIssue: Correct Rust code lowers to incorrect machine codeP-mediumMedium priorityMedium priorityS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixesIssue expected to be fixed by the next major LLVM upgrade, or backported fixesregression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.
Milestone
Description
I would expect the following program to always terminate since the address of a
must be distinct from the address of b
. Instead, it never terminates when built with -O
:
fn main() { f([32; 4]); } #[inline(never)] pub fn f(a: [usize; 4]) { g(a, a) } #[inline(never)] pub fn g(mut a: [usize; 4], mut b: [usize; 4]) { a[0] = 0; b[0] = 1; assert!(a[0] != b[0]); h(a.as_ptr(), b.as_ptr()); } #[inline(never)] pub fn h(x: *const usize, y: *const usize) { while x == y {} }
$ rustc +b41634205b549a62cfa55363d1e00c4143d30033 a.rs && ./a $ rustc +b41634205b549a62cfa55363d1e00c4143d30033 a.rs -O && ./a ^C
Meta
rustc +b41634205b549a62cfa55363d1e00c4143d30033--version --verbose
:
rustc 1.91.0-nightly (b41634205 2025-08-28) binary: rustc commit-hash: b41634205b549a62cfa55363d1e00c4143d30033 commit-date: 2025-08-28 host: x86_64-unknown-linux-gnu release: 1.91.0-nightly LLVM version: 21.1.0
sylv256
Metadata
Metadata
Assignees
Labels
A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.Category: This is a bug.I-miscompileIssue: Correct Rust code lowers to incorrect machine codeIssue: Correct Rust code lowers to incorrect machine codeP-mediumMedium priorityMedium priorityS-has-mcveStatus: A Minimal Complete and Verifiable Example has been found for this issueStatus: A Minimal Complete and Verifiable Example has been found for this issueT-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.llvm-fixed-upstreamIssue expected to be fixed by the next major LLVM upgrade, or backported fixesIssue expected to be fixed by the next major LLVM upgrade, or backported fixesregression-from-stable-to-betaPerformance or correctness regression from stable to beta.Performance or correctness regression from stable to beta.