aboutsummaryrefslogtreecommitdiff
path: root/src/ir.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-06-19 15:55:09 +0100
committerGinger Bill <bill@gingerbill.org>2017-06-19 15:55:09 +0100
commit5427d144163af7353b91219a762a5cf4ea17968d (patch)
tree1479eaab4cb93cf58819ce844ed1d75f0bb98dea /src/ir.cpp
parent178236d1ff3c588f544e56258d3c27c6bbc23996 (diff)
Code will compile as 32 bit but will causes errors in the linker on Windows
Diffstat (limited to 'src/ir.cpp')
-rw-r--r--src/ir.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/ir.cpp b/src/ir.cpp
index 7e4858c44..85fd98147 100644
--- a/src/ir.cpp
+++ b/src/ir.cpp
@@ -2262,6 +2262,17 @@ irValue *ir_emit_comp(irProcedure *proc, TokenKind op_kind, irValue *left, irVal
left = ir_emit_conv(proc, left, ir_type(right));
} else if (right->kind == irValue_Constant || right->kind == irValue_Nil) {
right = ir_emit_conv(proc, right, ir_type(left));
+ } else {
+ gbAllocator a = proc->module->allocator;
+ i64 ls = type_size_of(a, ir_type(left));
+ i64 rs = type_size_of(a, ir_type(right));
+ if (ls < rs) {
+ left = ir_emit_conv(proc, left, ir_type(right));
+ } else if (ls > rs) {
+ right = ir_emit_conv(proc, right, ir_type(left));
+ } else {
+ right = ir_emit_conv(proc, right, ir_type(left));
+ }
}
Type *result = t_bool;