Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
clickingbuttons opened this issue Apr 10, 2024 · 1 comment
Closed

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

clickingbuttons opened this issue Apr 10, 2024 · 1 comment
Labels
arch-x86_64 64-bit x86 backend-self-hosted bug Observed behavior contradicts documented or intended behavior
Milestone

Comments

@clickingbuttons
Copy link
Contributor

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.

@jacobly0
Copy link
Member

jacobly0 commented Feb 8, 2025

This is the one that no longer reproduces when targeting linux.

@jacobly0 jacobly0 closed this as completed Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-x86_64 64-bit x86 backend-self-hosted bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

No branches or pull requests

3 participants