mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 22:58:46 +00:00
Add edge case check for "" string
This commit is contained in:
@@ -4895,6 +4895,9 @@ lbValue lb_const_value(lbModule *m, Type *type, ExactValue value, bool allow_loc
|
|||||||
if (is_type_cstring(res.type)) {
|
if (is_type_cstring(res.type)) {
|
||||||
res.value = ptr;
|
res.value = ptr;
|
||||||
} else {
|
} 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 str_len = LLVMConstInt(lb_type(m, t_int), value.value_string.len, true);
|
||||||
LLVMValueRef values[2] = {ptr, str_len};
|
LLVMValueRef values[2] = {ptr, str_len};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user