fixed bug #456966
[fw/sdcc] / src / SDCCicode.c
index c5bc3f15eb8a77665fb0ac47d42c1598531d7ad5..ebb5e9523748fc6424a72bd94e355e07327ae7d9 100644 (file)
@@ -1539,7 +1539,7 @@ geniCodeCast (sym_link * type, operand * op, bool implicit)
       (DCL_TYPE (optype) != DCL_TYPE (type)) &&
       !IS_GENPTR (type))
     {
-      werror (E_INCOMPAT_CAST);
+      werror (W_INCOMPAT_CAST);
       fprintf (stderr, "from type '");
       printTypeChain (optype, stderr);
       fprintf (stderr, "' to type '");
@@ -2400,7 +2400,7 @@ geniCodeLogic (operand * left, operand * right, int op)
 
   /* left is integral type and right is literal then
      check if the literal value is within bounds */
-  if (IS_INTEGRAL (ltype) && IS_LITERAL (rtype))
+  if (IS_INTEGRAL (ltype) && IS_VALOP (right) && IS_LITERAL (rtype))
     {
       int nbits = bitsForType (ltype);
       long v = (long) operandLitValue (right);
@@ -2665,7 +2665,8 @@ geniCodeCall (operand * left, ast * parms,int lvl)
   sym_link *type, *etype;
   int stack = 0;
 
-  if (!IS_FUNC(OP_SYMBOL(left)->type)) {
+  if (!IS_FUNC(OP_SYMBOL(left)->type) && 
+      !IS_CODEPTR(OP_SYMBOL(left)->type)) {
     werror (E_FUNCTION_EXPECTED);
     return NULL;
   }
@@ -3034,8 +3035,16 @@ geniCodeArrayInit (ast * tree, operand *array)
 {
   iCode *ic;
 
-  ic = newiCode (ARRAYINIT, array, NULL);
-  IC_ARRAYILIST (ic) = tree->values.constlist;
+  if (!getenv("TRY_THE_NEW_INITIALIZER")) {
+    ic = newiCode (ARRAYINIT, array, NULL);
+    IC_ARRAYILIST (ic) = tree->values.constlist;
+  } else {
+    operand *left=newOperand(), *right=newOperand();
+    left->type=right->type=SYMBOL;
+    OP_SYMBOL(left)=AST_SYMBOL(tree->left);
+    OP_SYMBOL(right)=AST_SYMBOL(tree->right);
+    ic = newiCode (ARRAYINIT, left, right);
+  }
   ADDTOCHAIN (ic);
 }