aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-01-06 03:52:49 -0700
committerAndrew Kelley <superjoe30@gmail.com>2016-01-06 03:52:49 -0700
commit3fbde00eee1298feec4051f103c1014fe5819ede (patch)
tree10b9f6b026d6a9d4bea850646e4f74d3645b365d /src
parentf751a85d557d11dbbf09a03797a32bfd3edc8d6e (diff)
downloadzig-3fbde00eee1298feec4051f103c1014fe5819ede.tar.gz
zig-3fbde00eee1298feec4051f103c1014fe5819ede.zip
codegen: fix lshr/ashr not looking at int sign
Diffstat (limited to 'src')
-rw-r--r--src/codegen.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 2264b08191..a69f9e30b8 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -542,8 +542,11 @@ static LLVMValueRef gen_arithmetic_bin_op(CodeGen *g, AstNode *source_node,
return LLVMBuildShl(g->builder, val1, val2, "");
case BinOpTypeBitShiftRight:
case BinOpTypeAssignBitShiftRight:
+ assert(op1_type->id == TypeTableEntryIdInt);
+ assert(op2_type->id == TypeTableEntryIdInt);
+
add_debug_source_node(g, source_node);
- if (op1_type->id == TypeTableEntryIdInt) {
+ if (op1_type->data.integral.is_signed) {
return LLVMBuildAShr(g->builder, val1, val2, "");
} else {
return LLVMBuildLShr(g->builder, val1, val2, "");