From: uz Date: Tue, 12 Feb 2013 19:51:11 +0000 (+0000) Subject: Quick fix for a problem in the OptLoad3 function. The fix isn't perfect and X-Git-Tag: V2.14~92 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e8964cde74f7667b568fb8d841cf85e6978cc9d1;p=cc65 Quick fix for a problem in the OptLoad3 function. The fix isn't perfect and may fail for inline assembly code, but at least it's less buggy than before. git-svn-id: svn://svn.cc65.org/cc65/trunk@5982 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/codeopt.c b/src/cc65/codeopt.c index 758d4893d..9006ea8ff 100644 --- a/src/cc65/codeopt.c +++ b/src/cc65/codeopt.c @@ -248,6 +248,8 @@ static unsigned OptLoad3 (CodeSeg* S) /* Check if this insn is a load */ if (E->Info & OF_LOAD) { + CodeEntry* N; + /* If we had a preceeding load that is identical, remove this one. * If it is not identical, or we didn't have one, remember it. */ @@ -255,7 +257,9 @@ static unsigned OptLoad3 (CodeSeg* S) E->OPC == Load->OPC && E->AM == Load->AM && ((E->Arg == 0 && Load->Arg == 0) || - strcmp (E->Arg, Load->Arg) == 0)) { + strcmp (E->Arg, Load->Arg) == 0) && + (N = CS_GetNextEntry (S, I)) != 0 && + (N->Info & OF_CBRA) == 0) { /* Now remove the call to the subroutine */ CS_DelEntry (S, I);