Skip to content

Miscompilation of tuple arguments with mir-opt-level=2 #66971

Closed
@bytwise

Description

@bytwise

This reduced testcase is getting miscompiled with mir-opt-level=2. I bisected it to #64890.

fn encode(this: ((), u8, u8)) {
    // this assert panics although this.2 is 0
    assert!(this.2 == 0);
}

fn emit() {
    encode(((), 0, 0));
}

fn emit_inc() -> Box<()> {
    emit();
    Box::new(())
}

fn main() {
    emit_inc();
}

Rust version:

rustc 1.41.0-nightly (4007d4ef2 2019-12-01)
binary: rustc
commit-hash: 4007d4ef26eab44bdabc2b7574d032152264d3ad
commit-date: 2019-12-01
host: x86_64-apple-darwin
release: 1.41.0-nightly
LLVM version: 9.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-MIRArea: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlC-bugCategory: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions