git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1279
4a8a32a2-be11-0410-ad9d-
d568d2c75423
/* make sure the type is complete and sane */
checkTypeSanity(LETYPE(tree), "(cast)");
/* make sure the type is complete and sane */
checkTypeSanity(LETYPE(tree), "(cast)");
/* if the right is a literal replace the tree */
if (IS_LITERAL (RETYPE (tree))) {
if (!IS_PTR (LTYPE (tree))) {
/* if the right is a literal replace the tree */
if (IS_LITERAL (RETYPE (tree))) {
if (!IS_PTR (LTYPE (tree))) {
TTYPE (tree) = LTYPE (tree);
LRVAL (tree) = 1;
}
TTYPE (tree) = LTYPE (tree);
LRVAL (tree) = 1;
}
+#else
+ /* if the right is a literal replace the tree */
+ if (IS_LITERAL (RETYPE (tree)) && !IS_PTR (LTYPE (tree))) {
+ tree->type = EX_VALUE;
+ tree->opval.val =
+ valCastLiteral (LTYPE (tree),
+ floatFromVal (valFromType (RETYPE (tree))));
+ tree->left = NULL;
+ tree->right = NULL;
+ TTYPE (tree) = tree->opval.val->type;
+ tree->values.literalFromCast = 1;
+ } else {
+ TTYPE (tree) = LTYPE (tree);
+ LRVAL (tree) = 1;
+ }
+#endif
TETYPE (tree) = getSpec (TTYPE (tree));
TETYPE (tree) = getSpec (TTYPE (tree));
(*opp)->isaddr = cop->isaddr;
}
(*opp)->isaddr = cop->isaddr;
}
- if ((*opp)->type==VALUE &&
- IS_SYMOP(cop) && IS_GENPTR(OP_SYMBOL(cop)->type)) {
- // This is a value assigned to a gpointer
- if (1) {
- // this value is used for a cast, so we can not
- *opp=NULL;
- return 0;
- }
- }
-