diff options
| author | Jacob Young <jacobly0@users.noreply.github.com> | 2022-11-01 02:28:55 -0400 |
|---|---|---|
| committer | Jacob Young <jacobly0@users.noreply.github.com> | 2022-11-01 20:38:52 -0400 |
| commit | 8e52be1602f0b7953332d2e5e9a2b6f23e5410ce (patch) | |
| tree | f9f0560bfad4b7c6d0e552151d52de4c810cc697 /src/codegen/c.zig | |
| parent | fb8c08d4acec2ec0d9f06862276cfd6c1c32cd7f (diff) | |
| download | zig-8e52be1602f0b7953332d2e5e9a2b6f23e5410ce.tar.gz zig-8e52be1602f0b7953332d2e5e9a2b6f23e5410ce.zip | |
cbe: avoid emitting code for zero-bit field access
Diffstat (limited to 'src/codegen/c.zig')
| -rw-r--r-- | src/codegen/c.zig | 4 |
1 files changed, 3 insertions, 1 deletions
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); |
