]> git.gag.com Git - fw/sdcc/blobdiff - src/mcs51/gen.c
* src/mcs51/gen.c (genCpl): quick fix for bug #974835
[fw/sdcc] / src / mcs51 / gen.c
index 3e9b341c535a354251af99b23c18895bb6842681..ecd3bf860305d963f9ca599b1542dcedb369bd9b 100644 (file)
@@ -650,10 +650,10 @@ operandsEqu (operand * op1, operand * op2)
   if (sym1 == sym2)
     return TRUE;
 
-  if (strcmp (sym1->rname, sym2->rname) == 0)
+  if (sym1->rname[0] && sym2->rname[0]
+      && strcmp (sym1->rname, sym2->rname) == 0)
     return TRUE;
 
-
   /* if left is a tmp & right is not */
   if (IS_ITEMP (op1) &&
       !IS_ITEMP (op2) &&
@@ -1611,9 +1611,8 @@ genCpl (iCode * ic)
     {
       if (AOP_TYPE (IC_LEFT (ic)) == AOP_CRY)
        {
-         emitcode ("mov", "c,%s", IC_LEFT (ic)->aop->aopu.aop_dir);
-         emitcode ("cpl", "c");
-         emitcode ("mov", "%s,c", IC_RESULT (ic)->aop->aopu.aop_dir);
+         /* promotion rules are responsible for this strange result: */
+         emitcode ("setb", "%s", IC_RESULT (ic)->aop->aopu.aop_dir);
          goto release;
        }
 
@@ -4777,6 +4776,9 @@ genCmp (operand * left, operand * right,
                      if (!(AOP_TYPE (result) == AOP_CRY && AOP_SIZE (result)) && ifx)
                        {
                          genIfxJump (ifx, "acc.7", left, right, result);
+                         freeAsmop (right, NULL, ic, TRUE);
+                         freeAsmop (left, NULL, ic, TRUE);
+
                          return;
                        }
                      else