| ... | ... | @@ -7604,12 +7604,13 @@ static bool ir_emit_backward_branch(IrAnalyze *ira, IrInstruction *source_instru |
| 7604 | 7604 | size_t *bbc = ira->new_irb.exec->backward_branch_count; |
| 7605 | 7605 | size_t quota = ira->new_irb.exec->backward_branch_quota; |
| 7606 | 7606 | |
| 7607 | | // If we're already over quota, we've already given an error message for this. |
| 7608 | | if (*bbc > quota) |
| 7607 | if (ira->new_irb.exec->reported_quota_exceeded) { |
| 7609 | 7608 | return false; |
| 7609 | } |
| 7610 | 7610 | |
| 7611 | 7611 | *bbc += 1; |
| 7612 | 7612 | if (*bbc > quota) { |
| 7613 | ira->new_irb.exec->reported_quota_exceeded = true; |
| 7613 | 7614 | ir_add_error(ira, source_instruction, buf_sprintf("evaluation exceeded %" ZIG_PRI_usize " backwards branches", quota)); |
| 7614 | 7615 | return false; |
| 7615 | 7616 | } |
| ... | ... | @@ -12815,10 +12816,25 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira |
| 12815 | 12816 | if (container_type->id == TypeTableEntryIdStruct && !is_slice(container_type) && elem_count == 0) { |
| 12816 | 12817 | return ir_analyze_container_init_fields(ira, &instruction->base, container_type, |
| 12817 | 12818 | 0, nullptr); |
| 12818 | | } else if (is_slice(container_type)) { |
| 12819 | | TypeTableEntry *pointer_type = container_type->data.structure.fields[slice_ptr_index].type_entry; |
| 12820 | | assert(pointer_type->id == TypeTableEntryIdPointer); |
| 12821 | | TypeTableEntry *child_type = pointer_type->data.pointer.child_type; |
| 12819 | } else if (is_slice(container_type) || container_type->id == TypeTableEntryIdArray) { |
| 12820 | // array is same as slice init but we make a compile error if the length is wrong |
| 12821 | TypeTableEntry *child_type; |
| 12822 | if (container_type->id == TypeTableEntryIdArray) { |
| 12823 | child_type = container_type->data.array.child_type; |
| 12824 | if (container_type->data.array.len != elem_count) { |
| 12825 | TypeTableEntry *literal_type = get_array_type(ira->codegen, child_type, elem_count); |
| 12826 | |
| 12827 | ir_add_error(ira, &instruction->base, |
| 12828 | buf_sprintf("expected %s literal, found %s literal", |
| 12829 | buf_ptr(&container_type->name), buf_ptr(&literal_type->name))); |
| 12830 | return ira->codegen->builtin_types.entry_invalid; |
| 12831 | } |
| 12832 | } else { |
| 12833 | TypeTableEntry *pointer_type = container_type->data.structure.fields[slice_ptr_index].type_entry; |
| 12834 | assert(pointer_type->id == TypeTableEntryIdPointer); |
| 12835 | child_type = pointer_type->data.pointer.child_type; |
| 12836 | } |
| 12837 | |
| 12822 | 12838 | TypeTableEntry *fixed_size_array_type = get_array_type(ira->codegen, child_type, elem_count); |
| 12823 | 12839 | |
| 12824 | 12840 | ConstExprValue const_val = {}; |
| ... | ... | @@ -12882,9 +12898,6 @@ static TypeTableEntry *ir_analyze_instruction_container_init_list(IrAnalyze *ira |
| 12882 | 12898 | container_type_value, elem_count, new_items); |
| 12883 | 12899 | ir_add_alloca(ira, new_instruction, fixed_size_array_type); |
| 12884 | 12900 | return fixed_size_array_type; |
| 12885 | | } else if (container_type->id == TypeTableEntryIdArray) { |
| 12886 | | // same as slice init but we make a compile error if the length is wrong |
| 12887 | | zig_panic("TODO array container init"); |
| 12888 | 12901 | } else if (container_type->id == TypeTableEntryIdVoid) { |
| 12889 | 12902 | if (elem_count != 0) { |
| 12890 | 12903 | ir_add_error_node(ira, instruction->base.source_node, |