diff --git a/IDEHelper/Backend/BeMCContext.cpp b/IDEHelper/Backend/BeMCContext.cpp index 78068646..62dd85a0 100644 --- a/IDEHelper/Backend/BeMCContext.cpp +++ b/IDEHelper/Backend/BeMCContext.cpp @@ -15453,6 +15453,18 @@ void BeMCContext::Generate(BeFunction* function) // If we're clearing out this memory immediately after allocation then we don't // need to do stack probing - the memset will ensure stack pages are committed needsChkStk = false; + + if (mcSize.IsImmediate()) + { + if (auto sizeConst = BeValueDynCast(memSetInstr->mSize)) + { + if (sizeConst->mInt64 < mcSize.mImmediate) + { + // We haven't actually cleared out everything so we still need to chkStk + needsChkStk = true; + } + } + } } } }