| ... | ... | @@ -8686,6 +8686,10 @@ static void copy_const_val(ConstExprValue *dest, ConstExprValue *src, bool same_ |
| 8686 | 8686 | *dest = *src; |
| 8687 | 8687 | if (!same_global_refs) { |
| 8688 | 8688 | dest->global_refs = global_refs; |
| 8689 | if (dest->type->id == TypeTableEntryIdStruct) { |
| 8690 | dest->data.x_struct.fields = allocate_nonzero<ConstExprValue>(dest->type->data.structure.src_field_count); |
| 8691 | memcpy(dest->data.x_struct.fields, src->data.x_struct.fields, sizeof(ConstExprValue) * dest->type->data.structure.src_field_count); |
| 8692 | } |
| 8689 | 8693 | } |
| 8690 | 8694 | } |
| 8691 | 8695 | |
| ... | ... | @@ -11670,7 +11674,8 @@ static TypeTableEntry *ir_analyze_instruction_decl_var(IrAnalyze *ira, IrInstruc |
| 11670 | 11674 | if (var->mem_slot_index != SIZE_MAX) { |
| 11671 | 11675 | assert(var->mem_slot_index < ira->exec_context.mem_slot_count); |
| 11672 | 11676 | ConstExprValue *mem_slot = &ira->exec_context.mem_slot_list[var->mem_slot_index]; |
| 11673 | | *mem_slot = casted_init_value->value; |
| 11677 | copy_const_val(mem_slot, &casted_init_value->value, |
| 11678 | !is_comptime_var || var->gen_is_const); |
| 11674 | 11679 | |
| 11675 | 11680 | if (is_comptime_var || (var_class_requires_const && var->gen_is_const)) { |
| 11676 | 11681 | ir_build_const_from(ira, &decl_var_instruction->base); |