From 6907951f1eebcc9053ccfbe32a30dc704e790747 Mon Sep 17 00:00:00 2001 From: Ginger Bill Date: Thu, 22 Sep 2016 13:34:14 +0100 Subject: Fix type info generation The problem: entry's index != entry->value in info_type_map But I was assuming this --- src/codegen/ssa.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/codegen/ssa.cpp') diff --git a/src/codegen/ssa.cpp b/src/codegen/ssa.cpp index 959e3faf8..66d00ed0f 100644 --- a/src/codegen/ssa.cpp +++ b/src/codegen/ssa.cpp @@ -1327,6 +1327,8 @@ ssaValue *ssa_emit_deep_field_ev(ssaProcedure *proc, Type *type, ssaValue *e, Se isize ssa_type_info_index(CheckerInfo *info, Type *type) { + type = default_type(type); + isize entry_index = -1; HashKey key = hash_pointer(type); auto *found_entry_index = map_get(&info->type_info_map, key); @@ -1763,6 +1765,8 @@ ssaValue *ssa_emit_conv(ssaProcedure *proc, ssaValue *value, Type *t, b32 is_arg data = ssa_add_local_generated(proc, src_type); ssa_emit_store(proc, data, value); } + GB_ASSERT(is_type_pointer(ssa_type(data))); + GB_ASSERT(is_type_typed(src_type)); data = ssa_emit_conv(proc, data, t_rawptr); @@ -2157,6 +2161,10 @@ ssaValue *ssa_build_single_expr(ssaProcedure *proc, AstNode *expr, TypeAndValue Type *t = default_type(type_of_expr(proc->module->info, ce->args[0])); return ssa_type_info(proc, t); } break; + case BuiltinProc_type_info_of_val: { + Type *t = default_type(type_of_expr(proc->module->info, ce->args[0])); + return ssa_type_info(proc, t); + } break; case BuiltinProc_new: { ssa_emit_comment(proc, make_string("new")); -- cgit v1.2.3