From 8e52be1602f0b7953332d2e5e9a2b6f23e5410ce Mon Sep 17 00:00:00 2001 From: Jacob Young Date: Tue, 1 Nov 2022 02:28:55 -0400 Subject: cbe: avoid emitting code for zero-bit field access --- src/codegen/c.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/codegen') diff --git a/src/codegen/c.zig b/src/codegen/c.zig index 8bcb485e84..269383884d 100644 --- a/src/codegen/c.zig +++ b/src/codegen/c.zig @@ -4223,9 +4223,11 @@ fn airStructFieldVal(f: *Function, inst: Air.Inst.Index) !CValue { if (f.liveness.isUnused(inst)) return CValue.none; + const inst_ty = f.air.typeOfIndex(inst); + if (!inst_ty.hasRuntimeBitsIgnoreComptime()) return CValue.none; + const ty_pl = f.air.instructions.items(.data)[inst].ty_pl; const extra = f.air.extraData(Air.StructField, ty_pl.payload).data; - const inst_ty = f.air.typeOfIndex(inst); const target = f.object.dg.module.getTarget(); const struct_byval = try f.resolveInst(extra.struct_operand); const struct_ty = f.air.typeOf(extra.struct_operand); -- cgit v1.2.3