solve it a slightly different way
the error handling of result locations is a bit awkward but it should basically be the same everywhere
This commit is contained in:
parent
24deb1a7fe
commit
6bc520ab95
|
@ -24561,10 +24561,14 @@ static IrInstruction *ir_analyze_instruction_bit_cast_src(IrAnalyze *ira, IrInst
|
|||
|
||||
IrInstruction *result_loc = ir_resolve_result(ira, &instruction->base,
|
||||
&instruction->result_loc_bit_cast->base, operand->value.type, operand, false, false, true);
|
||||
if (result_loc != nullptr && !(type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)))
|
||||
if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc)))
|
||||
return result_loc;
|
||||
|
||||
return instruction->result_loc_bit_cast->parent->gen_instruction;
|
||||
if (instruction->result_loc_bit_cast->parent->gen_instruction != nullptr) {
|
||||
return instruction->result_loc_bit_cast->parent->gen_instruction;
|
||||
}
|
||||
|
||||
return result_loc;
|
||||
}
|
||||
|
||||
static IrInstruction *ir_analyze_instruction_union_init_named_field(IrAnalyze *ira,
|
||||
|
|
|
@ -129,4 +129,5 @@ test "implicit cast to error union by returning" {
|
|||
// issue #3010: compiler segfault
|
||||
test "bitcast literal [4]u8 param to u32" {
|
||||
const ip = @bitCast(u32, [_]u8{ 255, 255, 255, 255 });
|
||||
expect(ip == maxInt(u32));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user