aboutsummaryrefslogtreecommitdiff
path: root/src/codegen.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-08-06 18:15:11 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-08-06 18:15:11 -0400
commitd83e4092bfee7bfdb59d1522289aa0bc7df407e4 (patch)
treebbfd8e765bbd7130c22245095f18d8a4f8414951 /src/codegen.cpp
parenta0a57beed53a08346a3b6e0d739ee221f151ceca (diff)
downloadzig-d83e4092bfee7bfdb59d1522289aa0bc7df407e4.tar.gz
zig-d83e4092bfee7bfdb59d1522289aa0bc7df407e4.zip
fix constant debug info when number literal is 0
Diffstat (limited to 'src/codegen.cpp')
-rw-r--r--src/codegen.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/codegen.cpp b/src/codegen.cpp
index 2a3b4d7938..b5404c60d7 100644
--- a/src/codegen.cpp
+++ b/src/codegen.cpp
@@ -3891,6 +3891,9 @@ static void do_code_gen(CodeGen *g) {
ConstExprValue *const_val = var->value;
assert(const_val->special != ConstValSpecialRuntime);
size_t bits_needed = bigint_bits_needed(&const_val->data.x_bigint);
+ if (bits_needed < 8) {
+ bits_needed = 8;
+ }
TypeTableEntry *var_type = get_int_type(g, const_val->data.x_bigint.is_negative, bits_needed);
LLVMValueRef init_val = bigint_to_llvm_const(var_type->type_ref, &const_val->data.x_bigint);
gen_global_var(g, var, init_val, var_type);