mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Fix for undef index of sized array
This commit is contained in:
parent
5e4ecade6d
commit
a944aa6d24
1 changed files with 1 additions and 6 deletions
|
@ -17949,7 +17949,7 @@ void BfExprEvaluator::Visit(BfIndexerExpression* indexerExpr)
|
|||
mModule->MakeAddressable(target);
|
||||
|
||||
mModule->PopulateType(underlyingType);
|
||||
if (sizedArrayType->IsUnknownSizedArray())
|
||||
if ((sizedArrayType->IsUnknownSizedArray()) || (isUndefIndex))
|
||||
{
|
||||
mResult = mModule->GetDefaultTypedValue(underlyingType, false, BfDefaultValueKind_Addr);
|
||||
}
|
||||
|
@ -17968,11 +17968,6 @@ void BfExprEvaluator::Visit(BfIndexerExpression* indexerExpr)
|
|||
{
|
||||
if (target.mType->IsSizeAligned())
|
||||
{
|
||||
// auto ptrType = mModule->CreatePointerType(underlyingType);
|
||||
// auto ptrValue = mModule->mBfIRBuilder->CreateBitCast(target.mValue, mModule->mBfIRBuilder->MapType(ptrType));
|
||||
// auto gepResult = mModule->mBfIRBuilder->CreateInBoundsGEP(ptrValue, indexArgument.mValue);
|
||||
// mResult = BfTypedValue(gepResult, underlyingType, target.IsReadOnly() ? BfTypedValueKind_ReadOnlyAddr : BfTypedValueKind_Addr);
|
||||
|
||||
auto gepResult = mModule->mBfIRBuilder->CreateInBoundsGEP(target.mValue, mModule->GetConstValue(0), indexArgument.mValue);
|
||||
mResult = BfTypedValue(gepResult, underlyingType, target.IsReadOnly() ? BfTypedValueKind_ReadOnlyAddr : BfTypedValueKind_Addr);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue