From b6f356c2113d6ddb8c3e66d61123181e580b573e Mon Sep 17 00:00:00 2001 From: destroycomputers Date: Tue, 11 Apr 2023 01:11:01 +0200 Subject: Fix intrinsics.alloca code generation There was a disconnect between the declared return type for alloca intrinsic in check_builtin.cpp (multi_pointer(t_u8)) and the generated result type in llvm_backend_proc.cpp (t_u8_ptr). This allowed slicing the return type, but in the code generation process the type of the expression wasn't sliceable, which triggered the assert. Fixes #2139 --- src/llvm_backend_proc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/llvm_backend_proc.cpp') diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp index 02748663b..adc4f8458 100644 --- a/src/llvm_backend_proc.cpp +++ b/src/llvm_backend_proc.cpp @@ -2042,7 +2042,7 @@ gb_internal lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValu i64 al = exact_value_to_i64(type_and_value_of_expr(ce->args[1]).value); lbValue res = {}; - res.type = t_u8_ptr; + res.type = alloc_type_multi_pointer(t_u8); res.value = LLVMBuildArrayAlloca(p->builder, lb_type(p->module, t_u8), sz.value, ""); LLVMSetAlignment(res.value, cast(unsigned)al); return res; -- cgit v1.2.3