fixed an array to pointer bug
[fw/sdcc] / src / SDCCicode.c
index 0ccc0023e91f7b4bd99118c31a2d83dd51a5921e..297ed3a7954ac7ac98f4a546b150a4e696a94626 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 */
@@ -2118,8 +2112,10 @@ geniCodeStruct (operand * left, operand * right, bool islval)
   SPEC_OCLS (retype) = SPEC_OCLS (etype);
   SPEC_VOLATILE (retype) |= SPEC_VOLATILE (etype);
 
+#if 1 // jwk
   if (IS_PTR (element->type))
     setOperandType (IC_RESULT (ic), aggrToPtr (operandType (IC_RESULT (ic)), TRUE));
+#endif
 
   IC_RESULT (ic)->isaddr = (!IS_AGGREGATE (element->type));
 
@@ -2620,7 +2616,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 +2706,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)
     {