From 25ba5ca789af231612e128d3df6a7006a8846e37 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Mon, 31 Jan 2022 22:40:53 +0100 Subject: [PATCH] Fix absolute const pointer to int cast --- oscar64/InterCode.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/oscar64/InterCode.cpp b/oscar64/InterCode.cpp index 7c7a2c1..708595d 100644 --- a/oscar64/InterCode.cpp +++ b/oscar64/InterCode.cpp @@ -3356,6 +3356,20 @@ void InterCodeBasicBlock::CheckValueUsage(InterInstruction * ins, const GrowingI ins->mSrc[0].mTemp = -1; } } + else if (ins->mDst.mType == IT_INT16 && ins->mSrc[0].mType == IT_POINTER) + { + if (ins->mSrc[0].mTemp >= 0 && tvalue[ins->mSrc[0].mTemp]) + { + InterInstruction* cins = tvalue[ins->mSrc[0].mTemp]; + if (cins->mCode == IC_CONSTANT && cins->mConst.mMemory == IM_ABSOLUTE) + { + ins->mCode = IC_CONSTANT; + ins->mDst.mType = IT_INT16; + ins->mConst.mIntConst = cins->mConst.mIntConst; + ins->mSrc[0].mTemp = -1; + } + } + } break; case IC_CONVERSION_OPERATOR: