* support/regression/tests/bug-478094.c: Added.
[fw/sdcc] / src / SDCCicode.c
index 0ccc0023e91f7b4bd99118c31a2d83dd51a5921e..7dca929a28cb09708a605048325f32af70359385 100644 (file)
@@ -1276,7 +1276,6 @@ operandFromSymbol (symbol * sym)
       sym->level &&            /* is a local variable */
       !sym->addrtaken &&       /* whose address has not been taken */
       !sym->reqv &&            /* does not already have a reg equivalence */
-      !sym->onStack &&          /* jwk: not on stack */
       !IS_VOLATILE (sym->etype) &&     /* not declared as volatile */
       !IS_STATIC (sym->etype) &&       /* and not declared static  */
       !sym->islbl &&           /* not a label */
@@ -1292,6 +1291,7 @@ operandFromSymbol (symbol * sym)
       OP_SYMBOL (sym->reqv)->key = sym->key;
       OP_SYMBOL (sym->reqv)->isreqv = 1;
       OP_SYMBOL (sym->reqv)->islocal = 1;
+      OP_SYMBOL (sym->reqv)->onStack = sym->onStack;
       SPIL_LOC (sym->reqv) = sym;
     }
 
@@ -1658,13 +1658,7 @@ geniCodeCast (sym_link * type, operand * op, bool implicit)
     }
   }
   if (errors) {
-    /* fprintf (stderr, "%s%s %d: ", op->operand.symOperand->name,
-       implicit?"(implicit)":"", errors); */
-    fprintf (stderr, "from type '");
-    printTypeChain (optype, stderr);
-    fprintf (stderr, "' to type '");
-    printTypeChain (type, stderr);
-    fprintf (stderr, "'\n");
+    printFromToType (optype, type);
   }
 
   /* if they are the same size create an assignment */
@@ -2620,7 +2614,7 @@ geniCodeAssign (operand * left, operand * right, int nosupdate)
 
   /* first check the type for pointer assignement */
   if (left->isaddr && IS_PTR (ltype) && IS_ITEMP (left) &&
-      compareType (ltype, rtype) < 0)
+      compareType (ltype, rtype) <= 0)
     {
       if (compareType (ltype->next, rtype) < 0)
        right = geniCodeCast (ltype->next, right, TRUE);
@@ -2710,11 +2704,6 @@ geniCodeParms (ast * parms, value *argVals, int *stack,
     argVals=FUNC_ARGS(func->type);
   }
 
-  if (parms->argSym || 
-      (parms->type!=EX_OP && parms->type!=EX_OPERAND)) {
-    fprintf (stderr, "What the fuck??\n");
-  }
-
   /* if this is a param node then do the left & right */
   if (parms->type == EX_OP && parms->opval.op == PARAM)
     {
@@ -2743,8 +2732,7 @@ geniCodeParms (ast * parms, value *argVals, int *stack,
     }
 
   /* if register parm then make it a send */
-  if ((parms->argSym && IS_REGPARM(parms->argSym->etype)) ||
-      (IS_REGPARM (parms->etype) && !IFFUNC_HASVARARGS(func->type)))
+  if (IS_REGPARM (parms->etype) && !IFFUNC_HASVARARGS(func->type))
     {
       ic = newiCode (SEND, pval, NULL);
       ADDTOCHAIN (ic);
@@ -2962,14 +2950,14 @@ geniCodeIfx (ast * tree,int lvl)
          if (tree->trueLabel)
            geniCodeGoto (tree->trueLabel);
          else
-           assert (1);
+           assert (0);
        }
       else
        {
          if (tree->falseLabel)
            geniCodeGoto (tree->falseLabel);
          else
-           assert (1);
+           assert (0);
        }
       goto exit;
     }