| ... | ... | @@ -6233,6 +6233,15 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 6233 | 6233 | } |
| 6234 | 6234 | |
| 6235 | 6235 | if (elem_abi_size > 1 or dest_ty.isVolatilePtr()) { |
| 6236 | // For the assignment in this loop, the array pointer needs to get |
| 6237 | // casted to a regular pointer, otherwise an error like this occurs: |
| 6238 | // error: array type 'uint32_t[20]' (aka 'unsigned int[20]') is not assignable |
| 6239 | var elem_ptr_ty_pl: Type.Payload.ElemType = .{ |
| 6240 | .base = .{ .tag = .c_mut_pointer }, |
| 6241 | .data = elem_ty, |
| 6242 | }; |
| 6243 | const elem_ptr_ty = Type.initPayload(&elem_ptr_ty_pl.base); |
| 6244 | |
| 6236 | 6245 | const index = try f.allocLocal(inst, Type.usize); |
| 6237 | 6246 | |
| 6238 | 6247 | try writer.writeAll("for ("); |
| ... | ... | @@ -6256,7 +6265,9 @@ fn airMemset(f: *Function, inst: Air.Inst.Index, safety: bool) !CValue { |
| 6256 | 6265 | try f.writeCValue(writer, index, .Other); |
| 6257 | 6266 | try writer.writeAll(" += "); |
| 6258 | 6267 | try f.object.dg.renderValue(writer, Type.usize, Value.one, .Other); |
| 6259 | | try writer.writeAll(") ("); |
| 6268 | try writer.writeAll(") (("); |
| 6269 | try f.renderType(writer, elem_ptr_ty); |
| 6270 | try writer.writeByte(')'); |
| 6260 | 6271 | try writeSliceOrPtr(f, writer, dest_slice, dest_ty); |
| 6261 | 6272 | try writer.writeAll(")["); |
| 6262 | 6273 | try f.writeCValue(writer, index, .Other); |