aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-08-09 18:08:30 +0100
committergingerBill <bill@gingerbill.org>2022-08-09 18:08:30 +0100
commitff94c605e01a20c44e34ebd8469b9ceffbed6f59 (patch)
treeba690148b1961a1b6af389f684dae801081c9b82 /src
parentcb0a59bb2cfdeb971e88f329f07783ba1f93a5c9 (diff)
Minor change to `lb_emit_store` for storing nil to procedure variables
Diffstat (limited to 'src')
-rw-r--r--src/llvm_backend_general.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/llvm_backend_general.cpp b/src/llvm_backend_general.cpp
index eb5cf371c..58de9d36a 100644
--- a/src/llvm_backend_general.cpp
+++ b/src/llvm_backend_general.cpp
@@ -853,7 +853,9 @@ void lb_emit_store(lbProcedure *p, lbValue ptr, lbValue value) {
if (LLVMIsNull(value.value)) {
LLVMTypeRef src_t = llvm_addr_type(p->module, ptr);
- if (lb_sizeof(src_t) <= lb_max_zero_init_size()) {
+ if (is_type_proc(a)) {
+ LLVMBuildStore(p->builder, LLVMConstNull(llvm_get_element_type(LLVMTypeOf(ptr.value))), ptr.value);
+ } else if (lb_sizeof(src_t) <= lb_max_zero_init_size()) {
LLVMBuildStore(p->builder, LLVMConstNull(src_t), ptr.value);
} else {
lb_mem_zero_ptr(p, ptr.value, a, 1);