From 7aec7f5c50d33368c860444b9cf1139ebb724945 Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Mon, 25 Apr 2022 21:22:25 +0200 Subject: [PATCH] Fix crash compiling indexed memcpy size --- oscar64/GlobalAnalyzer.cpp | 4 +++- oscar64/InterCodeGenerator.cpp | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/oscar64/GlobalAnalyzer.cpp b/oscar64/GlobalAnalyzer.cpp index 0714be1..1789dd8 100644 --- a/oscar64/GlobalAnalyzer.cpp +++ b/oscar64/GlobalAnalyzer.cpp @@ -364,7 +364,9 @@ Declaration * GlobalAnalyzer::Analyze(Expression* exp, Declaration* procDec) if (ldec->mType == DT_VARIABLE || ldec->mType == DT_ARGUMENT) ldec = ldec->mBase; rdec = Analyze(exp->mRight, procDec); - return ldec->mBase; + if (ldec->mBase) + return ldec->mBase; + break; case EX_QUALIFY: Analyze(exp->mLeft, procDec); return exp->mDecValue->mBase; diff --git a/oscar64/InterCodeGenerator.cpp b/oscar64/InterCodeGenerator.cpp index cf012be..9391c76 100644 --- a/oscar64/InterCodeGenerator.cpp +++ b/oscar64/InterCodeGenerator.cpp @@ -1990,7 +1990,7 @@ InterCodeGenerator::ExValue InterCodeGenerator::TranslateExpression(Declaration* if (exp->mRight->mType == EX_LIST) { Expression* tex = exp->mRight->mLeft, * sex = exp->mRight->mRight->mLeft, * nex = exp->mRight->mRight->mRight; - if (nex->mDecValue->mType == DT_CONST_INTEGER && nex->mDecValue->mInteger < 128) + if (nex->mType == EX_CONSTANT && nex->mDecValue->mType == DT_CONST_INTEGER && nex->mDecValue->mInteger < 128) { vl = TranslateExpression(procType, proc, block, tex, breakBlock, continueBlock, inlineMapper); if (vl.mType->mType == DT_TYPE_ARRAY)