fixed bug #443366
authorjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 23 Oct 2001 12:40:19 +0000 (12:40 +0000)
committerjohanknol <johanknol@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 23 Oct 2001 12:40:19 +0000 (12:40 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1436 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/SDCCast.c

index 9beec54f429136d3efcd7d40c16f872aee0d9f34..4572ac760c72eb72dc2db377f491334cc8e78b99 100644 (file)
@@ -3565,8 +3565,12 @@ createIf (ast * condAst, ast * ifBody, ast * elseBody)
   symbol *ifTrue, *ifFalse, *ifEnd;
 
   /* if neither exists */
-  if (!elseBody && !ifBody)
-    return condAst;
+  if (!elseBody && !ifBody) {
+    // if there are no side effects (i++, j() etc)
+    if (!hasSEFcalls(condAst)) {
+      return condAst;
+    }
+  }
 
   /* create the labels */
   sprintf (buffer, "_iffalse_%d", Lblnum);