Skip to content

x86_64 backend: wrong code with optionals #18959

@xxxbxxx

Description

@xxxbxxx

Zig Version

0.12.0-dev.2784+075e9564c

Steps to Reproduce and Observed Behavior

test {
    var v :?usize = null;
    v = 4;
    var ref : usize = 4;
    _ = &ref;
    if (v!=ref) @panic("boom");
}

fails with zig test repro.zig -target x86_64-linux-none -fno-llvm -fno-lld
but passes with zig test repro.zig -target x86_64-linux-none

Expected Behavior

the test passes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-x86_6464-bit x86backend-self-hostedbugObserved behavior contradicts documented or intended behaviormiscompilationThe compiler reports success but produces semantically incorrect code.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions