aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2020-03-22 20:57:04 +0000
committergingerBill <bill@gingerbill.org>2020-03-22 20:57:04 +0000
commit0730e01b24bfba4bd91f224dd4ecbeef23bd6c1c (patch)
tree1edc2d46a3eab435572675fc09329ef41e18a88e /src/ir.cpp
parent8093062e3b58af6124f75161be110a4eccef7b54 (diff)
parentdfc63dcb606146dcb7a4c1076e593c7991a84c9a (diff)
Merge branch 'master' into llvm-integration
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index ab6cbb151..e938049c4 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -3966,6 +3966,10 @@ irValue *ir_map_entries(irProcedure *proc, irValue *value) {
irValue *ir_map_entries_ptr(irProcedure *proc, irValue *value) {
gbAllocator a = ir_allocator();
Type *t = base_type(type_deref(ir_type(value)));
+ if (is_type_pointer(t)) {
+ value = ir_emit_load(proc, value);
+ t = base_type(type_deref(t));
+ }
GB_ASSERT_MSG(t->kind == Type_Map, "%s", type_to_string(t));
init_map_internal_types(t);
Type *gst = t->Map.generated_struct_type;
@@ -9991,7 +9995,7 @@ void ir_build_stmt_internal(irProcedure *proc, Ast *node) {
gbAllocator a = ir_allocator();
irAddr addr = ir_build_addr(proc, expr);
irValue *map = ir_addr_get_ptr(proc, addr);
- if (is_type_pointer(type_deref(ir_addr_type(addr)))) {
+ if (is_type_pointer(ir_addr_type(addr))) {
map = ir_addr_load(proc, addr);
}
irValue *entries_ptr = ir_map_entries_ptr(proc, map);