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

Fixed potential non-const cast of array size in type lookup

This commit is contained in:
Brian Fiete 2021-01-05 16:23:49 -08:00
parent 080dd5a25e
commit a14544efa6

View file

@ -3171,10 +3171,14 @@ int BfResolvedTypeSet::Hash(BfTypeReference* typeRef, LookupContext* ctx, BfHash
hashVal = ((hashVal ^ elemHash) << 5) - hashVal; hashVal = ((hashVal ^ elemHash) << 5) - hashVal;
return hashVal; return hashVal;
} }
if (!typedVal) if (!typedVal)
ctx->mFailed = true; ctx->mFailed = true;
if (typedVal) if (typedVal)
{
SetAndRestoreValue<bool> prevIgnoreWrites(ctx->mModule->mBfIRBuilder->mIgnoreWrites, true);
typedVal = ctx->mModule->Cast(sizeExpr, typedVal, intType); typedVal = ctx->mModule->Cast(sizeExpr, typedVal, intType);
}
if (typedVal) if (typedVal)
{ {
auto constant = ctx->mModule->mBfIRBuilder->GetConstant(typedVal.mValue); auto constant = ctx->mModule->mBfIRBuilder->GetConstant(typedVal.mValue);