diff options
| author | gingerBill <bill@gingerbill.org> | 2019-10-26 14:43:06 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2019-10-26 14:43:06 +0100 |
| commit | 14e8b299b73c87d5c48e73add91d7a427d554d75 (patch) | |
| tree | 03a95a71c5d904fdde0964847e5f49fe0ad77a17 /src/ir.cpp | |
| parent | c7cb754514110d7d245ee2508fb8ccae7e24a420 (diff) | |
Fix slice and dynamic array lengths determined from ranged compound literals
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index 5eeba91a2..ae60be7e3 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -1552,7 +1552,7 @@ irValue *ir_add_module_constant(irModule *m, Type *type, ExactValue value) { if (count == 0) { return ir_value_nil(type); } - count = gb_max(cl->max_index+1, count); + count = gb_max(cl->max_count, count); Type *elem = base_type(type)->Slice.elem; Type *t = alloc_type_array(elem, count); irValue *backing_array = ir_add_module_constant(m, t, value); @@ -8047,7 +8047,7 @@ irAddr ir_build_addr(irProcedure *proc, Ast *expr) { irValue *size = ir_const_int(type_size_of(et)); irValue *align = ir_const_int(type_align_of(et)); - i64 item_count = gb_max(cl->max_index+1, cl->elems.count); + i64 item_count = gb_max(cl->max_count, cl->elems.count); { auto args = array_make<irValue *>(a, 5); |