aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2017-10-29 17:00:54 +0000
committergingerBill <bill@gingerbill.org>2017-10-29 17:00:54 +0000
commitae24a8e5ae77111cae24cd8d710b63636b737283 (patch)
tree8e84ae6aaf163a2c8c1a835748aa3504f3f4948d /src/ir.cpp
parentd2588f9d1da112b48f4a3f224b643bdd8f47f429 (diff)
Fix pointer arithmetic; remove suffix #tags for proc types
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp7
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));