aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-04-11 22:43:33 +0100
committerGinger Bill <bill@gingerbill.org>2017-04-11 22:43:33 +0100
commit8e73d1ce1f840c71ff5df03a360b5870140be86e (patch)
tree5ac32504ef6b8a434c0db72e884bf3574f2b9aa1 /src
parentb53d16d1d568fc0a3c87d1168b4cd8e2572cc41c (diff)
Fix map bug which removed N values from the beginning
Diffstat (limited to 'src')
-rw-r--r--src/ir.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/ir.c b/src/ir.c
index 96e82038b..df6c02bec 100644
--- a/src/ir.c
+++ b/src/ir.c
@@ -1502,12 +1502,15 @@ irValue *ir_gen_map_header(irProcedure *proc, irValue *map_val, Type *map_type)
ir_emit_store(proc, ir_emit_struct_ep(proc, h, 1), v_true);
}
- i64 entry_size = type_size_of(a, map_type->Map.entry_type);
- i64 entry_align = type_align_of(a, map_type->Map.entry_type);
+ i64 entry_size = type_size_of(a, map_type->Map.entry_type);
+ i64 entry_align = type_align_of(a, map_type->Map.entry_type);
i64 value_offset = type_offset_of(a, map_type->Map.entry_type, 2);
+ i64 value_size = type_size_of(a, map_type->Map.value);
+
ir_emit_store(proc, ir_emit_struct_ep(proc, h, 2), ir_const_int(a, entry_size));
ir_emit_store(proc, ir_emit_struct_ep(proc, h, 3), ir_const_int(a, entry_align));
ir_emit_store(proc, ir_emit_struct_ep(proc, h, 4), ir_const_int(a, value_offset));
+ ir_emit_store(proc, ir_emit_struct_ep(proc, h, 5), ir_const_int(a, value_size));
return ir_emit_load(proc, h);