From d676ccc1bda1a5188aafc0991be0676c0bb9771a Mon Sep 17 00:00:00 2001 From: drmortalwombat <90205530+drmortalwombat@users.noreply.github.com> Date: Sat, 6 Jan 2024 14:03:29 +0100 Subject: [PATCH] Fix dbj file reference with optimized variable --- oscar64/Compiler.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/oscar64/Compiler.cpp b/oscar64/Compiler.cpp index ac8841d..95b285a 100644 --- a/oscar64/Compiler.cpp +++ b/oscar64/Compiler.cpp @@ -1435,6 +1435,7 @@ bool Compiler::WriteDbjFile(const char* filename) InterVariable* v(p->mLocalVars[i]); if (v && v->mIdent) { + bool skipped = false; if (v->mLinkerObject) { if (v->mLinkerObject->mFlags & LOBJF_PLACED) @@ -1450,11 +1451,13 @@ bool Compiler::WriteDbjFile(const char* filename) } else { + skipped = true; // Prepared space on the stack but not used } } else if (v->mTemp) { + skipped = true; // Promoted to local variable } else if (p->mFramePointer) @@ -1480,9 +1483,12 @@ bool Compiler::WriteDbjFile(const char* filename) types.IndexOrPush(v->mDeclaration->mBase)); } - if (v->mDeclaration) - DumpReferences(file, v->mDeclaration); - fprintf(file, "}"); + if (!skipped) + { + if (v->mDeclaration) + DumpReferences(file, v->mDeclaration); + fprintf(file, "}"); + } } }