diff options
| -rw-r--r-- | src/llvm_backend_expr.cpp | 5 | ||||
| -rw-r--r-- | src/llvm_backend_general.cpp | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/src/llvm_backend_expr.cpp b/src/llvm_backend_expr.cpp index 0649150ca..fcec59968 100644 --- a/src/llvm_backend_expr.cpp +++ b/src/llvm_backend_expr.cpp @@ -4726,9 +4726,12 @@ gb_internal lbAddr lb_build_addr_internal(lbProcedure *p, Ast *expr) { if (sub_sel.index.count > 0) { ptr = lb_emit_deep_field_gep(p, ptr, sub_sel); } + if (is_type_pointer(type_deref(ptr.type))) { + ptr = lb_emit_load(p, ptr); + } Type *bf_type = type_deref(ptr.type); - bf_type = base_type(type_deref(bf_type)); + bf_type = base_type(bf_type); GB_ASSERT(bf_type->kind == Type_BitField); i32 index = sel.index[sel.index.count-1]; diff --git a/src/llvm_backend_general.cpp b/src/llvm_backend_general.cpp index 889cb8822..0d8d9258a 100644 --- a/src/llvm_backend_general.cpp +++ b/src/llvm_backend_general.cpp @@ -453,7 +453,7 @@ gb_internal lbAddr lb_addr_swizzle_large(lbValue addr, Type *array_type, Slice<i gb_internal lbAddr lb_addr_bit_field(lbValue addr, Type *type, i64 index, i64 bit_offset, i64 bit_size) { GB_ASSERT(is_type_pointer(addr.type)); Type *mt = type_deref(addr.type); - GB_ASSERT(is_type_bit_field(mt)); + GB_ASSERT_MSG(is_type_bit_field(mt), "%s", type_to_string(mt)); lbAddr v = {lbAddr_BitField, addr}; v.bitfield.type = type; |