From 8e7c7eeebabcf81e6ca06e44ae8b98554addd142 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Fri, 12 Aug 2022 13:48:10 +0100 Subject: Fix `lb_emit_ptr_offset` --- src/llvm_backend_proc.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/llvm_backend_proc.cpp') diff --git a/src/llvm_backend_proc.cpp b/src/llvm_backend_proc.cpp index ade2a55cf..784366476 100644 --- a/src/llvm_backend_proc.cpp +++ b/src/llvm_backend_proc.cpp @@ -2077,15 +2077,7 @@ lbValue lb_build_builtin_proc(lbProcedure *p, Ast *expr, TypeAndValue const &tv, lbValue ptr = lb_build_expr(p, ce->args[0]); lbValue len = lb_build_expr(p, ce->args[1]); len = lb_emit_conv(p, len, t_int); - - LLVMValueRef indices[1] = { - len.value, - }; - - lbValue res = {}; - res.type = tv.type; - res.value = LLVMBuildGEP2(p->builder, lb_type(p->module, type_deref(tv.type)), ptr.value, indices, gb_count_of(indices), ""); - return res; + return lb_emit_ptr_offset(p, ptr, len); } case BuiltinProc_ptr_sub: { -- cgit v1.2.3