diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-06-18 14:44:25 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-06-18 14:44:25 -0400 |
| commit | f90d17cc4db955ad6a3b866e641bf3bc0e7395f4 (patch) | |
| tree | cee34514ed23d9a5918df12a000003a5aa844655 /src | |
| parent | 077f9df15bffad714399762a5b0afe1bb8996ffb (diff) | |
| download | zig-f90d17cc4db955ad6a3b866e641bf3bc0e7395f4.tar.gz zig-f90d17cc4db955ad6a3b866e641bf3bc0e7395f4.zip | |
fix bitcast
Diffstat (limited to 'src')
| -rw-r--r-- | src/ir.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index f8225a74f9..ce3c25b791 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -23195,14 +23195,19 @@ static IrInstruction *ir_analyze_ptr_cast(IrAnalyze *ira, IrInstruction *source_ } } - IrInstruction *result = ir_const(ira, source_instr, dest_type); + IrInstruction *result; + if (ptr->value.data.x_ptr.mut == ConstPtrMutInfer) { + result = ir_build_ptr_cast_gen(ira, source_instr, dest_type, ptr, safety_check_on); + } else { + result = ir_const(ira, source_instr, dest_type); + } copy_const_val(&result->value, val, true); result->value.type = dest_type; // Keep the bigger alignment, it can only help- // unless the target is zero bits. if (src_align_bytes > dest_align_bytes && type_has_bits(dest_type)) { - result = ir_align_cast(ira, result, src_align_bytes, false); + result = ir_align_cast(ira, result, src_align_bytes, false); } return result; |
