-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Miscompilation with pointer address rountrip through address 0 #107326
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.A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-strict-provenanceArea: Strict provenance for raw pointersArea: Strict provenance for raw pointersC-bugCategory: This is a bug.Category: This is a bug.T-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.A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-strict-provenanceArea: Strict provenance for raw pointersArea: Strict provenance for raw pointersC-bugCategory: This is a bug.Category: This is a bug.T-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.
playground
The program gets optimized into
ud2.original example:
I tried this code:
I expected to see this happen: The program always prints
false.Instead, this happened: The program prints
trueif optimizations are enabled.The documentation of
from_exposed_addr_mutsays that the function will "guess" the correct provenance if able, so I expected it to guessptr.with_addr(0)here.Miri does not detect undefined behavior in the program.
Meta
playground nightly (2023-01-25 c18a5e8)