From: johanknol Date: Mon, 17 Sep 2001 13:27:17 +0000 (+0000) Subject: undid the fix for bug #455597, there has to be a better way X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=356b9e6840e7ec836bbf69ee0dfca7c6d07fb9a4;p=fw%2Fsdcc undid the fix for bug #455597, there has to be a better way git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@1279 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/src/SDCCast.c b/src/SDCCast.c index 8399cca0..7606c13d 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -2761,6 +2761,7 @@ decorateType (ast * tree) /* make sure the type is complete and sane */ checkTypeSanity(LETYPE(tree), "(cast)"); +#if 0 /* if the right is a literal replace the tree */ if (IS_LITERAL (RETYPE (tree))) { if (!IS_PTR (LTYPE (tree))) { @@ -2788,6 +2789,22 @@ decorateType (ast * tree) 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)); diff --git a/src/SDCCcse.c b/src/SDCCcse.c index 45a0aef7..7d1de84b 100644 --- a/src/SDCCcse.c +++ b/src/SDCCcse.c @@ -326,16 +326,6 @@ DEFSETFUNC (findCheaperOp) (*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; - } - } - return 1; }