aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_expr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/llvm_backend_expr.cpp')
-rw-r--r--src/llvm_backend_expr.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/llvm_backend_expr.cpp b/src/llvm_backend_expr.cpp
index 5bf2642e6..442121f83 100644
--- a/src/llvm_backend_expr.cpp
+++ b/src/llvm_backend_expr.cpp
@@ -4684,15 +4684,17 @@ gb_internal lbAddr lb_build_addr_internal(lbProcedure *p, Ast *expr) {
Selection sub_sel = sel;
sub_sel.index.count -= 1;
- Type *bf_type = type_from_selection(type, sub_sel);
- bf_type = base_type(type_deref(bf_type));
- GB_ASSERT(bf_type->kind == Type_BitField);
lbValue a = lb_addr_get_ptr(p, addr);
if (sub_sel.index.count > 0) {
a = lb_emit_deep_field_gep(p, a, sub_sel);
}
+
+ Type *bf_type = type_deref(a.type);
+ bf_type = base_type(type_deref(bf_type));
+ GB_ASSERT(bf_type->kind == Type_BitField);
+
i32 index = sel.index[sel.index.count-1];
Entity *f = bf_type->BitField.fields[index];