Fix crash on late const typecast to pointer
This commit is contained in:
parent
3770a05aee
commit
58361e39b8
|
@ -103,19 +103,19 @@ static bool iec_writeb(char b)
|
|||
|
||||
while (!data_in());
|
||||
|
||||
delay(5);
|
||||
for(char i=0; i<8; i++)
|
||||
{
|
||||
delay(8);
|
||||
clock_false();
|
||||
delay(8);
|
||||
delay(4);
|
||||
if (b & 1)
|
||||
data_true();
|
||||
else
|
||||
data_false();
|
||||
clock_true();
|
||||
b >>= 1;
|
||||
delay(4);
|
||||
}
|
||||
delay(8);
|
||||
clock_false();
|
||||
data_true();
|
||||
|
||||
|
|
|
@ -5020,6 +5020,22 @@ bool InterInstruction::ConstantFolding(void)
|
|||
return true;
|
||||
}
|
||||
break;
|
||||
case IC_TYPECAST:
|
||||
if (mSrc[0].mTemp < 0)
|
||||
{
|
||||
if (mDst.mType == IT_POINTER && IsIntegerType(mSrc[0].mType))
|
||||
{
|
||||
mCode = IC_CONSTANT;
|
||||
mConst.mType = IT_POINTER;
|
||||
mConst.mMemory = IM_ABSOLUTE;
|
||||
mConst.mIntConst = mSrc[0].mIntConst;
|
||||
mConst.mLinkerObject = nullptr;
|
||||
mConst.mOperandSize = 2;
|
||||
mNumOperands = 0;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case IC_LOAD_TEMPORARY:
|
||||
if (mDst.mTemp == mSrc[0].mTemp)
|
||||
{
|
||||
|
@ -21000,7 +21016,7 @@ void InterCodeProcedure::Close(void)
|
|||
{
|
||||
GrowingTypeArray tstack(IT_NONE);
|
||||
|
||||
CheckFunc = !strcmp(mIdent->mString, "_menuShowSprites");
|
||||
CheckFunc = !strcmp(mIdent->mString, "main");
|
||||
CheckCase = false;
|
||||
|
||||
mEntryBlock = mBlocks[0];
|
||||
|
|
Loading…
Reference in New Issue