From 2d50d56606cc384f4aa7102e946ab6d1be85d837 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Tue, 27 Feb 2024 18:02:12 +0100 Subject: [PATCH] Fix copy and load with striped arrays --- oscar64/InterCode.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/oscar64/InterCode.cpp b/oscar64/InterCode.cpp index 3200130..f37a84d 100644 --- a/oscar64/InterCode.cpp +++ b/oscar64/InterCode.cpp @@ -732,9 +732,22 @@ static bool SameMemRegion(const InterOperand& op1, const InterOperand& op2) // returns true if op2 is part of op1 static bool SameMemSegment(const InterOperand& op1, const InterOperand& op2) { - if (op1.mMemory != op2.mMemory || op1.mIntConst > op2.mIntConst || op1.mIntConst + op1.mOperandSize < op2.mIntConst + op2.mOperandSize || op1.mStride != op2.mStride) + if (op1.mMemory != op2.mMemory || op1.mStride != op2.mStride) return false; + if (op1.mStride == 1) + { + if (op1.mIntConst > op2.mIntConst || op1.mIntConst + op1.mOperandSize < op2.mIntConst + op2.mOperandSize) + return false; + } + else + { + if (op1.mIntConst % op1.mStride != op2.mIntConst % op2.mStride) + return false; + if (op1.mIntConst > op2.mIntConst || op1.mIntConst + op1.mOperandSize * op1.mStride < op2.mIntConst + op2.mOperandSize * op2.mStride) + return false; + } + switch (op1.mMemory) { case IM_LOCAL: @@ -20239,7 +20252,7 @@ void InterCodeProcedure::Close(void) { GrowingTypeArray tstack(IT_NONE); - CheckFunc = !strcmp(mIdent->mString, "interpret_expression"); + CheckFunc = !strcmp(mIdent->mString, "interpret_statement"); CheckCase = false; mEntryBlock = mBlocks[0];