From 3b2f6679b5bfed330209ddf7a91d53d639f1fb5e Mon Sep 17 00:00:00 2001 From: cuz Date: Fri, 11 Aug 2000 19:26:19 +0000 Subject: [PATCH] Don't create code for a subtraction of zero git-svn-id: svn://svn.cc65.org/cc65/trunk@267 b7a2c559-68d2-44c3-8de9-860c34a00d81 --- src/cc65/codegen.c | 5 +++++ 1 file changed, 5 insertions(+) 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) { -- 2.39.5