From 40aa27c42c0d87fc857757a4bfcc21ae509f4db5 Mon Sep 17 00:00:00 2001 From: lyken Date: Wed, 28 Aug 2024 12:16:55 +0800 Subject: [PATCH] array use i64_type().const_int for GEP --- nac3core/src/codegen/model/array.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nac3core/src/codegen/model/array.rs b/nac3core/src/codegen/model/array.rs index f46c9252..be52cefe 100644 --- a/nac3core/src/codegen/model/array.rs +++ b/nac3core/src/codegen/model/array.rs @@ -90,7 +90,7 @@ impl<'ctx, Len: ArrayLen, Item: Model<'ctx>> Instance<'ctx, Ptr ctx: &CodeGenContext<'ctx, '_>, i: IntValue<'ctx>, ) -> Instance<'ctx, Ptr> { - let zero = ctx.ctx.i32_type().const_zero(); + let zero = ctx.ctx.i64_type().const_zero(); let ptr = unsafe { ctx.builder.build_in_bounds_gep(self.value, &[zero, i], "").unwrap() }; unsafe { Ptr(self.model.0.item).believe_value(ptr) } @@ -104,7 +104,7 @@ impl<'ctx, Len: ArrayLen, Item: Model<'ctx>> Instance<'ctx, Ptr self.model.0.len.length() ); - let i = ctx.ctx.i32_type().const_int(i, false); + let i = ctx.ctx.i64_type().const_int(i, true); self.gep(ctx, i) }