| ... | ... | @@ -514,7 +514,7 @@ static LLVMValueRef gen_array_base_ptr(CodeGen *g, AstNode *node) { |
| 514 | 514 | array_ptr = gen_expr(g, node); |
| 515 | 515 | } |
| 516 | 516 | |
| 517 | | assert(LLVMGetTypeKind(LLVMTypeOf(array_ptr)) == LLVMPointerTypeKind); |
| 517 | assert(!array_ptr || LLVMGetTypeKind(LLVMTypeOf(array_ptr)) == LLVMPointerTypeKind); |
| 518 | 518 | |
| 519 | 519 | return array_ptr; |
| 520 | 520 | } |
| ... | ... | @@ -530,6 +530,10 @@ static LLVMValueRef gen_array_ptr(CodeGen *g, AstNode *node) { |
| 530 | 530 | LLVMValueRef subscript_value = gen_expr(g, node->data.array_access_expr.subscript); |
| 531 | 531 | assert(subscript_value); |
| 532 | 532 | |
| 533 | if (type_entry->size_in_bits == 0) { |
| 534 | return nullptr; |
| 535 | } |
| 536 | |
| 533 | 537 | if (type_entry->id == TypeTableEntryIdArray) { |
| 534 | 538 | LLVMValueRef indices[] = { |
| 535 | 539 | LLVMConstNull(g->builtin_types.entry_usize->type_ref), |
| ... | ... | @@ -670,7 +674,7 @@ static LLVMValueRef gen_array_access_expr(CodeGen *g, AstNode *node, bool is_lva |
| 670 | 674 | |
| 671 | 675 | LLVMValueRef ptr = gen_array_ptr(g, node); |
| 672 | 676 | |
| 673 | | if (is_lvalue) { |
| 677 | if (is_lvalue || !ptr) { |
| 674 | 678 | return ptr; |
| 675 | 679 | } else { |
| 676 | 680 | add_debug_source_node(g, node); |
| ... | ... | @@ -1189,6 +1193,10 @@ static LLVMValueRef gen_assign_expr(CodeGen *g, AstNode *node) { |
| 1189 | 1193 | |
| 1190 | 1194 | LLVMValueRef value = gen_expr(g, node->data.bin_op_expr.op2); |
| 1191 | 1195 | |
| 1196 | if (op1_type->size_in_bits == 0) { |
| 1197 | return nullptr; |
| 1198 | } |
| 1199 | |
| 1192 | 1200 | return gen_assign_raw(g, node, node->data.bin_op_expr.bin_op, target_ref, value, op1_type, op2_type); |
| 1193 | 1201 | } |
| 1194 | 1202 | |
| ... | ... | @@ -1723,7 +1731,7 @@ static LLVMValueRef gen_var_decl_raw(CodeGen *g, AstNode *source_node, AstNodeVa |
| 1723 | 1731 | if (var_decl->expr) { |
| 1724 | 1732 | *init_value = gen_expr(g, var_decl->expr); |
| 1725 | 1733 | } |
| 1726 | | if (variable->type->id == TypeTableEntryIdVoid) { |
| 1734 | if (variable->type->size_in_bits == 0) { |
| 1727 | 1735 | return nullptr; |
| 1728 | 1736 | } else { |
| 1729 | 1737 | if (var_decl->expr) { |
| ... | ... | @@ -1788,7 +1796,7 @@ static LLVMValueRef gen_symbol(CodeGen *g, AstNode *node) { |
| 1788 | 1796 | get_resolved_expr(node)->block_context, |
| 1789 | 1797 | &node->data.symbol_expr.symbol); |
| 1790 | 1798 | assert(variable); |
| 1791 | | if (variable->type->id == TypeTableEntryIdVoid) { |
| 1799 | if (variable->type->size_in_bits == 0) { |
| 1792 | 1800 | return nullptr; |
| 1793 | 1801 | } else if (variable->is_ptr) { |
| 1794 | 1802 | assert(variable->value_ref); |
| ... | ... | @@ -2122,8 +2130,9 @@ static void do_code_gen(CodeGen *g) { |
| 2122 | 2130 | break; |
| 2123 | 2131 | |
| 2124 | 2132 | VariableTableEntry *var = entry->value; |
| 2125 | | if (var->type->id == TypeTableEntryIdVoid) |
| 2133 | if (var->type->size_in_bits == 0) { |
| 2126 | 2134 | continue; |
| 2135 | } |
| 2127 | 2136 | |
| 2128 | 2137 | unsigned tag; |
| 2129 | 2138 | unsigned arg_no; |
| ... | ... | @@ -2732,7 +2741,9 @@ void codegen_add_root_code(CodeGen *g, Buf *src_dir, Buf *src_basename, Buf *sou |
| 2732 | 2741 | g->bootstrap_import = add_special_code(g, "bootstrap.zig"); |
| 2733 | 2742 | } |
| 2734 | 2743 | |
| 2735 | | add_special_code(g, "builtin.zig"); |
| 2744 | if (g->out_type == OutTypeExe) { |
| 2745 | add_special_code(g, "builtin.zig"); |
| 2746 | } |
| 2736 | 2747 | } |
| 2737 | 2748 | |
| 2738 | 2749 | if (g->verbose) { |