* src/SDCCcse.c (cseBBlock): fixed bug #966963
[fw/sdcc] / src / SDCCcse.c
index c57509201370e3d868ad059ec95cfe12ba7293a5..6094b0444d6a1efd22dfe76234e4dac7968af1e1 100644 (file)
@@ -1931,9 +1931,15 @@ cseBBlock (eBBlock * ebb, int computeOnly,
            {
              pdop = NULL;
              applyToSetFTrue (cseSet, findCheaperOp, IC_RESULT (ic), &pdop, 0);
-             if (pdop && !computeOnly &&
-                 IS_ITEMP (pdop) && IS_PTR(operandType(pdop)))
-               ReplaceOpWithCheaperOp (&IC_RESULT(ic), pdop);
+             if (pdop && !computeOnly && IS_ITEMP (pdop))
+               {
+                 ReplaceOpWithCheaperOp (&IC_RESULT(ic), pdop);
+                 if (!IS_PTR (operandType (IC_RESULT (ic))))
+                   {
+                     setOperandType (IC_RESULT (ic),
+                                     aggrToPtr (operandType (IC_RESULT (ic)), FALSE));
+                   }
+               }
            }
        }