Skip to content

Commit d908781

Browse files
committed
Fixes
1 parent 4cbb89d commit d908781

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/coreclr/interpreter/compiler.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,11 @@ void InterpCompiler::EmitCode()
761761

762762
// These will eventually be freed by the VM, and they use the delete [] operator for the deletion.
763763
m_pILToNativeMap = new ICorDebugInfo::OffsetMapping[m_ILCodeSize];
764-
ICorDebugInfo::NativeVarInfo* eeVars = new ICorDebugInfo::NativeVarInfo[m_numILVars];
764+
ICorDebugInfo::NativeVarInfo* eeVars = NULL;
765+
if (m_numILVars > 0)
766+
{
767+
eeVars = new ICorDebugInfo::NativeVarInfo[m_numILVars];
768+
}
765769

766770
int32_t *ip = m_pMethodCode;
767771
for (InterpBasicBlock *bb = m_pEntryBB; bb != NULL; bb = bb->pNextBB)
@@ -794,7 +798,10 @@ void InterpCompiler::EmitCode()
794798
j++;
795799
}
796800

797-
m_compHnd->setVars(m_methodInfo->ftn, m_numILVars, eeVars);
801+
if (m_numILVars > 0)
802+
{
803+
m_compHnd->setVars(m_methodInfo->ftn, m_numILVars, eeVars);
804+
}
798805
m_compHnd->setBoundaries(m_methodInfo->ftn, m_ILToNativeMapSize, m_pILToNativeMap);
799806
}
800807

@@ -1787,6 +1794,7 @@ int InterpCompiler::GenerateCode(CORINFO_METHOD_INFO* methodInfo)
17871794

17881795
if ((methodInfo->options & CORINFO_OPT_INIT_LOCALS) && m_ILLocalsSize > 0)
17891796
{
1797+
m_currentILOffset = 0;
17901798
AddIns(INTOP_INITLOCALS);
17911799
m_pLastNewIns->data[0] = m_ILLocalsOffset;
17921800
m_pLastNewIns->data[1] = m_ILLocalsSize;

0 commit comments

Comments
 (0)