* src/SDCCopt.c (killDeadCode): do not throw iCodes away if one
authortecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 22 Jan 2005 13:22:07 +0000 (13:22 +0000)
committertecodev <tecodev@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sat, 22 Jan 2005 13:22:07 +0000 (13:22 +0000)
  of the operands is volatile. Fixes #1020220

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3646 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/SDCCopt.c

index 75a82ee52d2522aacbc9a4f05efa594894a6ee6b..2d4c75d4f148ed34ff80313b5e19615e2d361fce 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2005-01-22 Daniel Winkler <post AT danielwinkler.de>
+
+       * src/SDCCopt.c (killDeadCode): do not throw iCodes away if one
+         of the operands is volatile. Fixes #1020220
+
 2005-01-22 Daniel Winkler <post AT danielwinkler.de>
 
        * src/pic16/pcoderegs.c (pCodeOptime2pCodes): reenabled optimization
index f7e67ce66cf3bd6f195da5534f806dc214ff4b21..1377a58e3243d81f3e251ad408da94734e8a2868 100644 (file)
@@ -879,6 +879,18 @@ killDeadCode (eBBlock ** ebbs, int count)
              if (IC_RESULT (ic) && isOperandVolatile (IC_RESULT (ic), FALSE))
                continue;
 
+             /* We also cannot remove the iCode, when an operand is volatile.       */
+             /* Even read access can cause side effects on some hardware registers! */
+
+             /* if the left operand is volatile then continue */
+             if (IC_LEFT(ic) && isOperandVolatile (IC_LEFT (ic), TRUE))
+               continue;
+
+             /* if the right operand is volatile then continue */
+             if (IC_RIGHT(ic) && isOperandVolatile (IC_RIGHT (ic), TRUE))
+               continue;
+
+
              /* if the result is a temp & isaddr then skip */
              if (IC_RESULT (ic) && POINTER_SET (ic))
                continue;