diff options
| author | gingerBill <bill@gingerbill.org> | 2022-09-07 11:09:22 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-09-07 11:09:22 +0100 |
| commit | 0c9aaed9f741c3b96c63e0cbc9e4e11f4510248a (patch) | |
| tree | 06026d0826ea3913d1a5267ffa4bce44049e549b /src/llvm_backend_const.cpp | |
| parent | 826a3b3012b781c972d3550b3999f6a9b4a09508 (diff) | |
Fix #2029 Eumerated array of procs literal crashes the compiler with an llvm error
Diffstat (limited to 'src/llvm_backend_const.cpp')
| -rw-r--r-- | src/llvm_backend_const.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/llvm_backend_const.cpp b/src/llvm_backend_const.cpp index 2d14070e2..5826dbaec 100644 --- a/src/llvm_backend_const.cpp +++ b/src/llvm_backend_const.cpp @@ -297,12 +297,16 @@ LLVMValueRef lb_build_constant_array_values(lbModule *m, Type *type, Type *elem_ } if (!is_const) { + LLVMTypeRef llvm_elem_type = lb_type(m, elem_type); lbProcedure *p = m->curr_procedure; GB_ASSERT(p != nullptr); lbAddr v = lb_add_local_generated(p, type, false); lbValue ptr = lb_addr_get_ptr(p, v); for (isize i = 0; i < count; i++) { lbValue elem = lb_emit_array_epi(p, ptr, i); + if (is_type_proc(elem_type)) { + values[i] = LLVMConstPointerCast(values[i], llvm_elem_type); + } LLVMBuildStore(p->builder, values[i], elem.value); } return lb_addr_load(p, v).value; |