From: cuz Date: Thu, 5 Dec 2002 12:59:07 +0000 (+0000) Subject: Fixed a bug X-Git-Tag: V2.12.0~1938 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e4d25caa56def564136e52140fb9bbd64809234a;p=cc65 Fixed a bug git-svn-id: svn://svn.cc65.org/cc65/trunk@1717 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/coptstop.c b/src/cc65/coptstop.c index 2a479ed41..5a512cb20 100644 --- a/src/cc65/coptstop.c +++ b/src/cc65/coptstop.c @@ -711,8 +711,16 @@ unsigned OptStackOps (CodeSeg* S) /* Handling depends if we're inside a sequence or not */ if (InSeq) { - if (((E->Use & REG_SP) != 0 && - (E->AM != AM65_ZP_INDY || RegValIsUnknown (E->RI->In.RegY)))) { + /* If we are using the stack, and we don't have "indirect Y" + * addressing mode, or the value of Y is unknown, or less than + * two, we cannot cope with this piece of code. Having an unknown + * value of Y means that we cannot correct the stack offset, while + * having an offset less than two means that the code works with + * the value on stack which is to be removed. + */ + if ((E->Use & REG_SP) != 0 && + (E->AM != AM65_ZP_INDY || RegValIsUnknown (E->RI->In.RegY) || + E->RI->In.RegY < 2)) { /* All this stuff is not allowed in a sequence */ InSeq = 0;