Skip to content

x86_64: Codegen fails on @min and @max for u128 #19606

Description

@clickingbuttons

Zig Version

0.12.0-dev.3528+423cb317f

Steps to Reproduce and Observed Behavior

pub fn main() void {
    std.debug.print("{d}\n", .{ @min(1, std.crypto.random.int(u128)) });
}

const std = @import("std");
./zig/build/stage4/bin/zig build-exe ./test.zig -fno-llvm -fno-lld -target x86_64-linux
Semantic Analysis [167] thread 2148577 panic: access of union field 'register_pair' while field 'load_symbol' is active
src/zig/src/arch/x86_64/CodeGen.zig:9948:36: 0x10e256977 in genBinOp (zig)
                            src_mcv.register_pair[0],
                                   ^
src/zig/src/arch/x86_64/CodeGen.zig:3434:38: 0x10e35dd93 in airBinOp (zig)
    const dst_mcv = try self.genBinOp(inst, tag, bin_op.lhs, bin_op.rhs);
                                     ^
src/zig/src/arch/x86_64/CodeGen.zig:1980:39: 0x10dde017f in genBody (zig)
            => |tag| try self.airBinOp(inst, tag),
                                      ^
src/zig/src/arch/x86_64/CodeGen.zig:1820:25: 0x10d87f7eb in gen (zig)
        try self.genBody(self.air.getMainBody());
                        ^
src/zig/src/arch/x86_64/CodeGen.zig:912:17: 0x10d3fa143 in generate (zig)
    function.gen() catch |err| switch (err) {

Expected Behavior

No crash. @jacobly0 probably knows what to do.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-x86_6464-bit x86backend-self-hostedbugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions