* src/SDCCopt.c (killDeadCode): fixed bug #907733
[fw/sdcc] / src / SDCCopt.c
index e76e30f39cd97ae71a17c880b6970b9eb28030d3..94ee6e187b5d0231dc418575b510578387eb20cd 100644 (file)
@@ -883,7 +883,8 @@ killDeadCode (eBBlock ** ebbs, int count)
              if (IC_RESULT (ic) && POINTER_SET (ic))
                continue;
               
-              if (POINTER_GET (ic) && IS_VOLATILE (operandType (IC_LEFT (ic))->next))
+              if (POINTER_GET (ic) && IS_VOLATILE (operandType (IC_LEFT (ic))->next)
+                 && !SPIL_LOC (IC_RESULT (ic)))
                 continue;
 
              /* if the result is used in the remainder of the */
@@ -947,6 +948,16 @@ killDeadCode (eBBlock ** ebbs, int count)
                        volRight = FALSE;
                    }
                  
+                 if (POINTER_GET (ic) && IS_VOLATILE (operandType (IC_LEFT (ic))->next))
+                   {
+                     if (SPIL_LOC (IC_RESULT (ic)))
+                       {
+                         IC_RESULT (ic) = newiTempFromOp (IC_RESULT (ic));
+                         SPIL_LOC (IC_RESULT (ic)) = NULL;
+                       }
+                     continue;
+                   }
+                 
                  change = 1;
                  gchange++;