@@ -6218,16 +6218,18 @@ static TypeTableEntry *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_nod
6218
6218
convert_to_const_slice = true;
6219
6219
continue;
6220
6220
} else if (cur_type->id == TypeTableEntryIdArray && is_slice(prev_type) &&
6221
- prev_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.is_const &&
6222
- types_match_const_cast_only(prev_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.child_type,
6223
- cur_type->data.array.child_type))
6221
+ (prev_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.is_const ||
6222
+ cur_type->data.array.len == 0) &&
6223
+ types_match_const_cast_only(prev_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.child_type,
6224
+ cur_type->data.array.child_type))
6224
6225
{
6225
6226
convert_to_const_slice = false;
6226
6227
continue;
6227
6228
} else if (prev_type->id == TypeTableEntryIdArray && is_slice(cur_type) &&
6228
- cur_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.is_const &&
6229
- types_match_const_cast_only(cur_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.child_type,
6230
- prev_type->data.array.child_type))
6229
+ (cur_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.is_const ||
6230
+ prev_type->data.array.len == 0) &&
6231
+ types_match_const_cast_only(cur_type->data.structure.fields[slice_ptr_index].type_entry->data.pointer.child_type,
6232
+ prev_type->data.array.child_type))
6231
6233
{
6232
6234
prev_inst = cur_inst;
6233
6235
convert_to_const_slice = false;
@@ -6796,8 +6798,9 @@ static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instructi
6796
6798
ConstExprValue *val = ir_resolve_const(ira, value, UndefBad);
6797
6799
if (!val)
6798
6800
return ira->codegen->invalid_instruction;
6801
+ bool final_is_const = (value->value.type->id == TypeTableEntryIdMetaType) ? is_const : true;
6799
6802
return ir_get_const_ptr(ira, source_instruction, val, value->value.type,
6800
- ConstPtrMutComptimeConst, is_const , is_volatile);
6803
+ ConstPtrMutComptimeConst, final_is_const , is_volatile);
6801
6804
}
6802
6805
6803
6806
TypeTableEntry *ptr_type = get_pointer_to_type_extra(ira->codegen, value->value.type, is_const, is_volatile, 0, 0);
@@ -6806,6 +6809,7 @@ static IrInstruction *ir_get_ref(IrAnalyze *ira, IrInstruction *source_instructi
6806
6809
IrInstruction *new_instruction = ir_build_ref(&ira->new_irb, source_instruction->scope,
6807
6810
source_instruction->source_node, value, is_const, is_volatile);
6808
6811
new_instruction->value.type = ptr_type;
6812
+ new_instruction->value.data.rh_ptr = RuntimeHintPtrStack;
6809
6813
fn_entry->alloca_list.append(new_instruction);
6810
6814
return new_instruction;
6811
6815
}
0 commit comments