Skip to content

Return value changed upon returning to callee (x86_64-unknown-none) #143436

Open
@elB4RTO

Description

@elB4RTO

When compiling for the target x86_64-unknown-none, using an opt-level higher than 0 resulted in a return value being changed upon returning to the callee.

The value is checked just before returning and it is a None, but right after returning the value becomes a Some. This doesn't happen when compiling with opt-level = 0, but any value higher than that triggers this behavior.

I've been unable to setup a minimum reproducible example, as the issue seems to appear in rare situations only, possibly depending on the context. Please refer to this PR for more information: elB4RTO/Rebel#8

I can provide the compiled binaries and/or the assembly dump of the faulty sections if needed

Compiler info

Output of rustc --version --verbose:

rustc 1.87.0 (17067e9ac 2025-05-09)
binary: rustc
commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
commit-date: 2025-05-09
host: x86_64-unknown-linux-gnu
release: 1.87.0
LLVM version: 20.1.1

Target triple: x86_64-unknown-none

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.S-needs-infoStatus: The issue lacks details necessary to triage or act on it.needs-triageThis issue may need triage. Remove it if it has been sufficiently triaged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions