diff options
| author | gingerBill <bill@gingerbill.org> | 2020-09-11 16:20:46 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-09-11 16:20:46 +0100 |
| commit | bf215377dee8c2ee25c9749cfe3a420bcb4eeb2b (patch) | |
| tree | f1accfdb8b7387f45ba15d7243ecf6e78c783020 /src | |
| parent | d317d3d8b3e182c735f9184db8324929d2f0a492 (diff) | |
Add edge case check for "" string
Diffstat (limited to 'src')
| -rw-r--r-- | src/llvm_backend.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/llvm_backend.cpp b/src/llvm_backend.cpp index a9fa039f9..1b3559aa0 100644 --- a/src/llvm_backend.cpp +++ b/src/llvm_backend.cpp @@ -4895,6 +4895,9 @@ lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bool allow_loc if (is_type_cstring(res.type)) { res.value = ptr; } else { + if (value.value_string.len == 0) { + ptr = LLVMConstNull(lb_type(m, t_u8_ptr)); + } LLVMValueRef str_len = LLVMConstInt(lb_type(m, t_int), value.value_string.len, true); LLVMValueRef values[2] = {ptr, str_len}; |