From: cuz Date: Fri, 11 Aug 2000 19:26:19 +0000 (+0000) Subject: Don't create code for a subtraction of zero X-Git-Tag: V2.12.0~3252 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=3b2f6679b5bfed330209ddf7a91d53d639f1fb5e;p=cc65 Don't create code for a subtraction of zero git-svn-id: svn://svn.cc65.org/cc65/trunk@267 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- diff --git a/src/cc65/codegen.c b/src/cc65/codegen.c index 7fcb122f1..4a041b4e8 100644 --- a/src/cc65/codegen.c +++ b/src/cc65/codegen.c @@ -3191,6 +3191,11 @@ void g_inc (unsigned flags, unsigned long val) void g_dec (unsigned flags, unsigned long val) /* Decrement the primary register by a given number */ { + /* Don't dec by zero */ + if (val == 0) { + return; + } + /* Generate code for the supported types */ flags &= ~CF_CONST; switch (flags & CF_TYPE) {