| ... | @@ -19757,6 +19757,8 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3 | ... | @@ -19757,6 +19757,8 @@ static IrInstruction *ir_align_cast(IrAnalyze *ira, IrInstruction *target, uint3 |
| 19757 | } | 19757 | } |
| 19758 | | 19758 | |
| 19759 | static TypeTableEntry *ir_analyze_instruction_ptr_cast(IrAnalyze *ira, IrInstructionPtrCast *instruction) { | 19759 | static TypeTableEntry *ir_analyze_instruction_ptr_cast(IrAnalyze *ira, IrInstructionPtrCast *instruction) { |
| | 19760 | Error err; |
| | 19761 | |
| 19760 | IrInstruction *dest_type_value = instruction->dest_type->other; | 19762 | IrInstruction *dest_type_value = instruction->dest_type->other; |
| 19761 | TypeTableEntry *dest_type = ir_resolve_type(ira, dest_type_value); | 19763 | TypeTableEntry *dest_type = ir_resolve_type(ira, dest_type_value); |
| 19762 | if (type_is_invalid(dest_type)) | 19764 | if (type_is_invalid(dest_type)) |
| ... | @@ -19810,9 +19812,13 @@ static TypeTableEntry *ir_analyze_instruction_ptr_cast(IrAnalyze *ira, IrInstruc | ... | @@ -19810,9 +19812,13 @@ static TypeTableEntry *ir_analyze_instruction_ptr_cast(IrAnalyze *ira, IrInstruc |
| 19810 | instruction->base.source_node, nullptr, ptr); | 19812 | instruction->base.source_node, nullptr, ptr); |
| 19811 | casted_ptr->value.type = dest_type; | 19813 | casted_ptr->value.type = dest_type; |
| 19812 | | 19814 | |
| 19813 | // keep the bigger alignment, it can only help | 19815 | // Keep the bigger alignment, it can only help- |
| | 19816 | // unless the target is zero bits. |
| | 19817 | if ((err = type_ensure_zero_bits_known(ira->codegen, dest_type))) |
| | 19818 | return ira->codegen->builtin_types.entry_invalid; |
| | 19819 | |
| 19814 | IrInstruction *result; | 19820 | IrInstruction *result; |
| 19815 | if (src_align_bytes > dest_align_bytes) { | 19821 | if (src_align_bytes > dest_align_bytes && type_has_bits(dest_type)) { |
| 19816 | result = ir_align_cast(ira, casted_ptr, src_align_bytes, false); | 19822 | result = ir_align_cast(ira, casted_ptr, src_align_bytes, false); |
| 19817 | if (type_is_invalid(result->value.type)) | 19823 | if (type_is_invalid(result->value.type)) |
| 19818 | return ira->codegen->builtin_types.entry_invalid; | 19824 | return ira->codegen->builtin_types.entry_invalid; |