Fix segfault with heap allocation

This commit is contained in:
root
2017-04-10 20:48:56 +01:00
parent 3a3202fbc6
commit 98d493504b
4 changed files with 27 additions and 32 deletions
+1 -1
View File
@@ -1090,7 +1090,7 @@ irValue *ir_generate_array(irModule *m, Type *elem_type, i64 count, String prefi
isize name_len = prefix.len + 10;
token.string.text = gb_alloc_array(a, u8, name_len);
token.string.len = gb_snprintf(cast(char *)token.string.text, name_len,
"%.*s-%llx", LIT(prefix), id)-1;
"%.*s-%llx", LIT(prefix), cast(unsigned long long)id)-1;
Entity *e = make_entity_variable(a, NULL, token, make_type_array(a, elem_type, count), false);
irValue *value = ir_value_global(a, e, NULL);
value->Global.is_private = true;