aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-12-07 15:44:28 +0000
committergingerBill <bill@gingerbill.org>2019-12-07 15:44:28 +0000
commit53cd7a3d0cb295173936a431fba667e3347b6f8b (patch)
treef749e34f60cc27cd88dc88f61a7997e397148af1 /src/ir.cpp
parentf1706486299af72505bce4d13d94d80571dd1829 (diff)
Fix `transmute` from `uintptr` to/from `proc`
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 78fe6519a..9639760f0 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -5594,6 +5594,14 @@ irValue *ir_emit_transmute(irProcedure *proc, irValue *value, Type *t) {
if (is_type_pointer(src) && is_type_uintptr(dst)) {
return ir_emit_ptr_to_uintptr(proc, value, t);
}
+ if (is_type_uintptr(src) && is_type_proc(dst)) {
+ irValue *ptr = ir_emit_uintptr_to_ptr(proc, value, t_rawptr);
+ return ir_emit_bitcast(proc, ptr, dst);
+ }
+ if (is_type_proc(src) && is_type_uintptr(dst)) {
+ irValue *ptr = ir_emit_uintptr_to_ptr(proc, value, t_rawptr);
+ return ir_emit_bitcast(proc, ptr, dst);
+ }
if (is_type_integer(src) && (is_type_pointer(dst) || is_type_cstring(dst))) {
Type *vt = core_type(ir_type(value));