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

Allow [Unchecked] bounds check disabling on sized array indexing

This commit is contained in:
Brian Fiete 2022-01-22 10:38:05 -05:00
parent 89b597c913
commit 46611ee8f2

View file

@ -20091,7 +20091,7 @@ void BfExprEvaluator::Visit(BfIndexerExpression* indexerExpr)
auto indexConst = mModule->mBfIRBuilder->GetConstant(indexArgument.mValue);
if (indexConst->mUInt64 >= (uint64)sizedArrayType->mElementCount)
{
if (!mModule->IsInSpecializedSection())
if ((!mModule->IsInSpecializedSection()) && (checkedKind != BfCheckedKind_Unchecked))
{
mModule->Fail(StrFormat("Index '%d' is out of bounds for type '%s'", indexConst->mInt32, mModule->TypeToString(target.mType).c_str()), indexerExpr->mArguments[0]);
mResult = _GetDefaultResult();