| ... | @@ -3417,7 +3417,10 @@ pub const DeclGen = struct { | ... | @@ -3417,7 +3417,10 @@ pub const DeclGen = struct { |
| 3417 | }); | 3417 | }); |
| 3418 | const ty_bit_size = @intCast(u16, field.ty.bitSize(target)); | 3418 | const ty_bit_size = @intCast(u16, field.ty.bitSize(target)); |
| 3419 | const small_int_ty = dg.context.intType(ty_bit_size); | 3419 | const small_int_ty = dg.context.intType(ty_bit_size); |
| 3420 | const small_int_val = non_int_val.constBitCast(small_int_ty); | 3420 | const small_int_val = if (field.ty.isPtrAtRuntime()) |
| | 3421 | non_int_val.constPtrToInt(small_int_ty) |
| | 3422 | else |
| | 3423 | non_int_val.constBitCast(small_int_ty); |
| 3421 | const shift_rhs = int_llvm_ty.constInt(running_bits, .False); | 3424 | const shift_rhs = int_llvm_ty.constInt(running_bits, .False); |
| 3422 | // If the field is as large as the entire packed struct, this | 3425 | // If the field is as large as the entire packed struct, this |
| 3423 | // zext would go from, e.g. i16 to i16. This is legal with | 3426 | // zext would go from, e.g. i16 to i16. This is legal with |
| ... | @@ -5343,7 +5346,7 @@ pub const FuncGen = struct { | ... | @@ -5343,7 +5346,7 @@ pub const FuncGen = struct { |
| 5343 | const same_size_int = self.context.intType(elem_bits); | 5346 | const same_size_int = self.context.intType(elem_bits); |
| 5344 | const truncated_int = self.builder.buildTrunc(shifted_value, same_size_int, ""); | 5347 | const truncated_int = self.builder.buildTrunc(shifted_value, same_size_int, ""); |
| 5345 | return self.builder.buildBitCast(truncated_int, elem_llvm_ty, ""); | 5348 | return self.builder.buildBitCast(truncated_int, elem_llvm_ty, ""); |
| 5346 | } else if (field_ty.zigTypeTag() == .Pointer) { | 5349 | } else if (field_ty.isPtrAtRuntime()) { |
| 5347 | const elem_bits = @intCast(c_uint, field_ty.bitSize(target)); | 5350 | const elem_bits = @intCast(c_uint, field_ty.bitSize(target)); |
| 5348 | const same_size_int = self.context.intType(elem_bits); | 5351 | const same_size_int = self.context.intType(elem_bits); |
| 5349 | const truncated_int = self.builder.buildTrunc(shifted_value, same_size_int, ""); | 5352 | const truncated_int = self.builder.buildTrunc(shifted_value, same_size_int, ""); |
| ... | @@ -8408,7 +8411,7 @@ pub const FuncGen = struct { | ... | @@ -8408,7 +8411,7 @@ pub const FuncGen = struct { |
| 8408 | const non_int_val = try self.resolveInst(elem); | 8411 | const non_int_val = try self.resolveInst(elem); |
| 8409 | const ty_bit_size = @intCast(u16, field.ty.bitSize(target)); | 8412 | const ty_bit_size = @intCast(u16, field.ty.bitSize(target)); |
| 8410 | const small_int_ty = self.dg.context.intType(ty_bit_size); | 8413 | const small_int_ty = self.dg.context.intType(ty_bit_size); |
| 8411 | const small_int_val = if (field.ty.zigTypeTag() == .Pointer) | 8414 | const small_int_val = if (field.ty.isPtrAtRuntime()) |
| 8412 | self.builder.buildPtrToInt(non_int_val, small_int_ty, "") | 8415 | self.builder.buildPtrToInt(non_int_val, small_int_ty, "") |
| 8413 | else | 8416 | else |
| 8414 | self.builder.buildBitCast(non_int_val, small_int_ty, ""); | 8417 | self.builder.buildBitCast(non_int_val, small_int_ty, ""); |