-
-
Couldn't load subscription status.
- Fork 3.1k
Closed
Labels
arch-x86_6464-bit x8664-bit x86backend-self-hostedbugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviormiscompilationThe compiler reports success but produces semantically incorrect code.The compiler reports success but produces semantically incorrect code.
Milestone
Description
Zig Version
master
Steps to Reproduce and Observed Behavior
const std = @import("std");
const Data = packed struct {
rd: u5,
rl: bool,
};
pub const Operand = union(enum) {
reg: enum {
t0, // commenting this out fixes the issue
s0,
},
barrier: enum(u4) {
rl,
},
};
pub fn main() !void {
var rd: Operand = .{ .reg = .s0 };
var rl: Operand = .{ .barrier = .rl };
_ = &rd;
_ = &rl;
const ret: Data = .{
.rd = @intFromEnum(rd.reg),
.rl = rl.barrier == .rl,
};
std.debug.print("ret: {}, {}\n", .{ ret.rl, rl.barrier == .rl });
}output:
ret: false, true
Expected Behavior
when commenting out the t0 enum and/or compiling with LLVM, expected output is:
ret: true, true
lin72h
Metadata
Metadata
Assignees
Labels
arch-x86_6464-bit x8664-bit x86backend-self-hostedbugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviormiscompilationThe compiler reports success but produces semantically incorrect code.The compiler reports success but produces semantically incorrect code.