| ... | @@ -3497,9 +3497,27 @@ fn airOverflow(f: *Function, inst: Air.Inst.Index, operation: []const u8, info: | ... | @@ -3497,9 +3497,27 @@ fn airOverflow(f: *Function, inst: Air.Inst.Index, operation: []const u8, info: |
| 3497 | try w.writeAll(operation); | 3497 | try w.writeAll(operation); |
| 3498 | try w.writeAll("o_"); | 3498 | try w.writeAll("o_"); |
| 3499 | try f.dg.renderTypeForBuiltinFnName(w, scalar_ty); | 3499 | try f.dg.renderTypeForBuiltinFnName(w, scalar_ty); |
| 3500 | try w.writeAll("(&"); | 3500 | try w.writeByte('('); |
| | 3501 | |
| | 3502 | // '&dest', possibly preceded by a cast |
| | 3503 | switch (zcu.intern_pool.indexToKey(scalar_ty.toIntern())) { |
| | 3504 | .int_type => {}, // we already have a '[u]intX_t *' |
| | 3505 | .simple_type => { |
| | 3506 | // '&dest' will be something like a 'uintptr_t *', which might be a different C type to |
| | 3507 | // the equivalent sized integer (e.g. 'uint64_t *'), so we need a cast. We don't need a |
| | 3508 | // cast on the *operands* because they are passed by value (except for big integers, |
| | 3509 | // where this issue doesn't exist because no "simple" int type needs bigint repr). |
| | 3510 | try w.print("({s}int{d}_t *)", .{ |
| | 3511 | if (scalar_ty.isUnsignedInt(zcu)) "u" else "", |
| | 3512 | scalar_ty.abiSize(zcu) * 8, |
| | 3513 | }); |
| | 3514 | }, |
| | 3515 | else => unreachable, |
| | 3516 | } |
| | 3517 | try w.writeByte('&'); |
| 3501 | try f.writeCValueMember(w, local, .{ .field = 0 }); | 3518 | try f.writeCValueMember(w, local, .{ .field = 0 }); |
| 3502 | try v.elem(f, w); | 3519 | try v.elem(f, w); |
| | 3520 | |
| 3503 | try w.writeAll(", "); | 3521 | try w.writeAll(", "); |
| 3504 | if (ref_arg) try w.writeByte('&'); | 3522 | if (ref_arg) try w.writeByte('&'); |
| 3505 | try f.writeCValue(w, lhs, .other); | 3523 | try f.writeCValue(w, lhs, .other); |