| author | |
| committer | |
| log | 07c5e906010e85d7e6560dc3ed398d7e4b284ec0 |
| tree | 81cdb2ae9662ac51d905eea0ccd40948ebc99c2a |
| parent | efc2237e5a545fac94ecc9c9757d202bda322abd |
| parent | 6bc520ab957e25f9ae6d0f4d8a8ad4b96e145ac3 |
| signature |
closes #3022
closes #3010
thanks @mikdusan2 files changed, 11 insertions(+), 1 deletions(-)
src/ir.cpp+5-1| ... | ... | @@ -24564,7 +24564,11 @@ static IrInstruction *ir_analyze_instruction_bit_cast_src(IrAnalyze *ira, IrInst |
| 24564 | 24564 | if (result_loc != nullptr && (type_is_invalid(result_loc->value.type) || instr_is_unreachable(result_loc))) |
| 24565 | 24565 | return result_loc; |
| 24566 | 24566 | |
| 24567 | return instruction->result_loc_bit_cast->parent->gen_instruction; | |
| 24567 | if (instruction->result_loc_bit_cast->parent->gen_instruction != nullptr) { | |
| 24568 | return instruction->result_loc_bit_cast->parent->gen_instruction; | |
| 24569 | } | |
| 24570 | ||
| 24571 | return result_loc; | |
| 24568 | 24572 | } |
| 24569 | 24573 | |
| 24570 | 24574 | static IrInstruction *ir_analyze_instruction_union_init_named_field(IrAnalyze *ira, |
test/stage1/behavior/bitcast.zig+6| ... | ... | @@ -125,3 +125,9 @@ test "implicit cast to error union by returning" { |
| 125 | 125 | S.entry(); |
| 126 | 126 | comptime S.entry(); |
| 127 | 127 | } |
| 128 | ||
| 129 | // issue #3010: compiler segfault | |
| 130 | test "bitcast literal [4]u8 param to u32" { | |
| 131 | const ip = @bitCast(u32, [_]u8{ 255, 255, 255, 255 }); | |
| 132 | expect(ip == maxInt(u32)); | |
| 133 | } |