-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
i2p-p2i-opt miscompiles rust code #147538
Copy link
Copy link
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 codeT-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.
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 codeT-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.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Making a separate tracking issue for the core problem @nikic identified in #147265 (comment) since it's been in stable since at least May 2024.
The following rust code: https://rust.godbolt.org/z/eT9fbKvbq
in 1.77 compiled to
but starting in 1.78 becomes
The change on the rust side is #121282 (cc @saethlin), but that's just exposing the problem in this example -- the root problem could probably be repro'd on older stable too, just in less-obvious ways.
For now we mitigated this with #147541, but that's likely just a partial fix. That PR should be reverted when the issue is properly fixed.
It happens because LLVM removes the
ptrtoint+inttoptrthat's needed to recover exposed provenance from an otherwise-without_provenancepointer.