diff options
Diffstat (limited to 'src/ir.cpp')
| -rw-r--r-- | src/ir.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/ir.cpp b/src/ir.cpp index ce868a280..b0a4985db 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -2195,8 +2195,8 @@ irValue *ir_emit_arith(irProcedure *proc, TokenKind op, irValue *left, irValue * Type *ptr_type = base_type(t_left); GB_ASSERT(!is_type_rawptr(ptr_type)); irValue *elem_size = ir_const_int(m->allocator, type_size_of(m->allocator, ptr_type->Pointer.elem)); - irValue *x = ir_emit_conv(proc, left, type); - irValue *y = ir_emit_conv(proc, right, type); + irValue *x = ir_emit_conv(proc, ir_emit_conv(proc, left, t_uintptr), type); + irValue *y = ir_emit_conv(proc, ir_emit_conv(proc, right, t_uintptr), type); irValue *diff = ir_emit_arith(proc, op, x, y, type); return ir_emit_arith(proc, Token_Quo, diff, elem_size, type); } @@ -3027,7 +3027,7 @@ irValue *ir_emit_conv(irProcedure *proc, irValue *value, Type *t) { return ir_emit(proc, ir_instr_conv(proc, kind, value, src_type, t)); } - // Pointer <-> int + // Pointer <-> uintptr if (is_type_pointer(src) && is_type_uintptr(dst)) { return ir_emit_ptr_to_uintptr(proc, value, t); } @@ -3185,6 +3185,7 @@ irValue *ir_emit_conv(irProcedure *proc, irValue *value, Type *t) { } + gb_printf_err("ir_emit_conv: src -> dst\n"); gb_printf_err("Not Identical %s != %s\n", type_to_string(src_type), type_to_string(t)); gb_printf_err("Not Identical %s != %s\n", type_to_string(src), type_to_string(dst)); |