Skip to content

Commit 64baa7c

Browse files
committed
fix slice malloc
1 parent ba10e8f commit 64baa7c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/compiler/types/type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func (s Slice) SliceZero(block *ir.Block, mallocFunc llvmValue.Named, initLen, i
312312
block.NewStore(initCap32, cap)
313313
block.NewStore(constant.NewInt(types.I32, 0), offset)
314314

315-
size := block.NewMul(initCap, constant.NewInt(types.I64, s.Type.Size()))
315+
size := block.NewMul(initCap32, constant.NewInt(types.I32, s.Type.Size()))
316316
mallocatedSpaceRaw := block.NewCall(mallocFunc, size)
317317
mallocatedSpaceRaw.SetName(name.Var("slicezero"))
318318
bitcasted := block.NewBitCast(mallocatedSpaceRaw, types.NewPointer(s.Type.LLVM()))

0 commit comments

Comments
 (0)