From 826a7e6fba505f5e8c9e75c0e89e2bd81454e247 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 16 Nov 2020 09:46:25 -0800 Subject: [PATCH] Fixed append alloc array size calculation --- IDEHelper/Compiler/BfModule.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IDEHelper/Compiler/BfModule.cpp b/IDEHelper/Compiler/BfModule.cpp index 2bdf75fd..df9c878b 100644 --- a/IDEHelper/Compiler/BfModule.cpp +++ b/IDEHelper/Compiler/BfModule.cpp @@ -617,7 +617,7 @@ public: { curAlign = resultType->mAlign; EmitAppendAlign(resultType->mAlign); - sizeValue = mModule->mBfIRBuilder->CreateMul(mModule->GetConstValue(resultType->mSize), allocCount); + sizeValue = mModule->mBfIRBuilder->CreateMul(mModule->GetConstValue(resultType->GetStride()), allocCount); } else { @@ -633,7 +633,7 @@ public: int arrayClassSize = arrayType->mInstSize - firstElementField->mDataSize; sizeValue = mModule->GetConstValue(arrayClassSize); - BfIRValue elementDataSize = mModule->mBfIRBuilder->CreateMul(mModule->GetConstValue(resultType->mSize), allocCount); + BfIRValue elementDataSize = mModule->mBfIRBuilder->CreateMul(mModule->GetConstValue(resultType->GetStride()), allocCount); sizeValue = mModule->mBfIRBuilder->CreateAdd(sizeValue, elementDataSize); } }