+2001-01-02 Bernhard Held <bernhard@bernhardheld.de>
+
+ * src/SDCCast.c: fix #498138 by Johan
+
+ * src/SDCCglue.c: fix #498138 by Johan
+
2001-01-02 Bernhard Held <bernhard@bernhardheld.de>
* support/regression/Makefile: fix clean
/* if we are casting a literal value then */
if (IS_AST_OP (cexpr) &&
cexpr->opval.op == CAST &&
- IS_LITERAL (cexpr->left->ftype))
+ IS_LITERAL (cexpr->right->ftype))
return valCastLiteral (cexpr->ftype,
- floatFromVal (cexpr->left->opval.val));
+ floatFromVal (cexpr->right->opval.val));
if (IS_AST_VALUE (cexpr))
return cexpr->opval.val;
if (compareType (LTYPE (tree), RTYPE (tree)) == 0)
{
werror (E_TYPE_MISMATCH, "assignment", " ");
- fprintf (stderr, "type --> '");
- printTypeChain (RTYPE (tree), stderr);
- fprintf (stderr, "' ");
- fprintf (stderr, "assigned to type --> '");
- printTypeChain (LTYPE (tree), stderr);
- fprintf (stderr, "'\n");
- goto errorTreeReturn;
+ printFromToType(RTYPE(tree),LTYPE(tree));
+ //goto errorTreeReturn;
}
/* if the left side of the tree is of type void
int dLvl = 0;
val = list2val (ilist);
+
+ if (IS_LITERAL(val->etype)) {
+ if (compareType(type,val->etype)==0) {
+ werror (E_INCOMPAT_TYPES);
+ printFromToType (val->type, type);
+ }
+ printIvalCharPtr (NULL, type, val, oFile);
+ return;
+ }
+
/* check the types */
if ((dLvl = compareType (val->type, type->next)) <= 0)
{
aopLiteral (val, 0), aopLiteral (val, 1));
break;
case 3:
- // mcs51 generic pointer
- if (floatFromVal(val)!=0) {
+ if (IS_GENPTR(type) && floatFromVal(val)!=0) {
+ // non-zero mcs51 generic pointer
werror (E_LITERAL_GENERIC);
}
fprintf (oFile, "\t.byte %s,%s,%s\n",
aopLiteral (val, 2));
break;
case 4:
- // ds390 generic pointer
- if (floatFromVal(val)!=0) {
+ if (IS_GENPTR(type) && floatFromVal(val)!=0) {
+ // non-zero ds390 generic pointer
werror (E_LITERAL_GENERIC);
}
fprintf (oFile, "\t.byte %s,%s,%s,%s\n",