1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 12:32:20 +02:00

Fixed zero-sized sized array loop issues

This commit is contained in:
Brian Fiete 2021-01-19 05:40:57 -08:00
parent 966b740e6c
commit c0e19171d4
5 changed files with 83 additions and 11 deletions

View file

@ -19161,9 +19161,7 @@ void BfExprEvaluator::Visit(BfIndexerExpression* indexerExpr)
mResult = BfTypedValue(mModule->mBfIRBuilder->GetFakeVal(), underlyingType, true);
else
{
mResult = mModule->GetDefaultTypedValue(underlyingType);
if (sizedArrayType->mElementCount != 0)
mModule->AssertErrorState();
mResult = mModule->GetDefaultTypedValue(underlyingType, false, BfDefaultValueKind_Addr);
}
}
else if (target.IsAddr())

View file

@ -5053,11 +5053,6 @@ BfIRValue BfModule::CreateTypeDataRef(BfType* type)
BfMangler::Mangle(typeDataName, mCompiler->GetMangleKind(), type, this);
}
if (typeDataName == "?sBfTypeData@Zoing@BeefTest@bf@@2HA")
{
NOP;
}
BfLogSysM("Creating TypeData %s\n", typeDataName.c_str());
globalVariable = mBfIRBuilder->CreateGlobalVariable(mBfIRBuilder->MapTypeInst(typeTypeInst, BfIRPopulateType_Full), true, BfIRLinkageType_External, BfIRValue(), typeDataName);

View file

@ -3686,7 +3686,7 @@ BfTypedValue CeContext::Call(BfAstNode* targetSrc, BfModule* module, BfMethodIns
AutoTimer autoTimer(mCeMachine->mRevisionExecuteTime);
SetAndRestoreValue<CeContext*> prevContext(mCeMachine->mCurContext, this);
SetAndRestoreValue<CeContext*> prevContext(mCeMachine->mCurContext, this);
SetAndRestoreValue<CeEvalFlags> prevEvalFlags(mCurEvalFlags, flags);
SetAndRestoreValue<BfAstNode*> prevTargetSrc(mCurTargetSrc, targetSrc);
SetAndRestoreValue<BfModule*> prevModule(mCurModule, module);
@ -3942,9 +3942,13 @@ BfTypedValue CeContext::Call(BfAstNode* targetSrc, BfModule* module, BfMethodIns
Fail("Failed to encode return argument");
}
}
else if (returnType->IsComposite())
{
returnValue = BfTypedValue(module->mBfIRBuilder->CreateConstArrayZero(module->mBfIRBuilder->MapType(returnType)), returnType);
}
else
{
returnValue = BfTypedValue(module->mBfIRBuilder->GetFakeVal(), returnType);
returnValue = BfTypedValue(module->mBfIRBuilder->GetFakeVal(), returnType);
}
}