authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-15 18:57:36-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-07-15 18:57:36-07:00
logba623b160ed43b720a6c653a24e9efb91f52d326
tree3b30dfe43d9998a62bb8b3899956b3c78667b36a
parent60318a1e39897a0535cf7699c2e4ab6366d0687f

Zir: fix wrong union field access for declaration


1 files changed, 6 insertions(+), 4 deletions(-)

lib/std/zig/Zir.zig+6-4
...@@ -1,5 +1,7 @@...@@ -1,5 +1,7 @@
1//! Zig Intermediate Representation. Astgen.zig converts AST nodes to these1//! Zig Intermediate Representation.
2//! untyped IR instructions. Next, Sema.zig processes these into AIR.2//!
3//! Astgen.zig converts AST nodes to these untyped IR instructions. Next,
4//! Sema.zig processes these into AIR.
3//! The minimum amount of information needed to represent a list of ZIR instructions.5//! The minimum amount of information needed to represent a list of ZIR instructions.
4//! Once this structure is completed, it can be used to generate AIR, followed by6//! Once this structure is completed, it can be used to generate AIR, followed by
5//! machine code, without any memory access into the AST tree token list, node list,7//! machine code, without any memory access into the AST tree token list, node list,
...@@ -4024,8 +4026,8 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash {...@@ -4024,8 +4026,8 @@ pub fn getAssociatedSrcHash(zir: Zir, inst: Zir.Inst.Index) ?std.zig.SrcHash {
4024 const data = zir.instructions.items(.data);4026 const data = zir.instructions.items(.data);
4025 switch (tag[@intFromEnum(inst)]) {4027 switch (tag[@intFromEnum(inst)]) {
4026 .declaration => {4028 .declaration => {
4027 const pl_node = data[@intFromEnum(inst)].pl_node;4029 const declaration = data[@intFromEnum(inst)].declaration;
4028 const extra = zir.extraData(Inst.Declaration, pl_node.payload_index);4030 const extra = zir.extraData(Inst.Declaration, declaration.payload_index);
4029 return @bitCast([4]u32{4031 return @bitCast([4]u32{
4030 extra.data.src_hash_0,4032 extra.data.src_hash_0,
4031 extra.data.src_hash_1,4033 extra.data.src_hash_1,