X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=src%2FSDCCast.c;h=0ec893b325ca6bdc95ef66031acf72ec2e31fbd4;hb=a38f33ebea19e30a1adc71fb457b4002c4c3c787;hp=bdae3d5a90e620d7a4eeb4dc15329530eae0103c;hpb=c6306c2fbf7c546ffebe284ffeb4ea55ed765811;p=fw%2Fsdcc diff --git a/src/SDCCast.c b/src/SDCCast.c index bdae3d5a..0ec893b3 100644 --- a/src/SDCCast.c +++ b/src/SDCCast.c @@ -863,6 +863,8 @@ processParms (ast *func, ftype = (*actParm)->ftype; + resultType = RESULT_TYPE_NONE; + /* If it's a char, upcast to int. */ if (IS_INTEGRAL (ftype) && (getSize (ftype) < (unsigned) INTSIZE)) @@ -874,12 +876,14 @@ processParms (ast *func, { newType = newAst_LINK (copyLinkChain(ftype)); DCL_TYPE (newType->opval.lnk) = port->unqualified_pointer; + resultType = RESULT_TYPE_GPTR; } if (IS_AGGREGATE (ftype)) { newType = newAst_LINK (copyLinkChain (ftype)); DCL_TYPE (newType->opval.lnk) = port->unqualified_pointer; + resultType = RESULT_TYPE_GPTR; } if (newType) @@ -890,7 +894,7 @@ processParms (ast *func, (*actParm)->filename = (*actParm)->right->filename; (*actParm)->lineno = (*actParm)->right->lineno; - decorateType (*actParm, RESULT_TYPE_NONE); + decorateType (*actParm, resultType); } return 0; } /* vararg */ @@ -3251,7 +3255,7 @@ decorateType (ast * tree, RESULT_TYPE resultType) werrorfl (tree->filename, tree->lineno, E_LVALUE_REQUIRED, "pointer deref"); goto errorTreeReturn; } - if (IS_ADDRESS_OF_OP(tree->left)) + if (IS_ADDRESS_OF_OP (tree->left)) { /* replace *&obj with obj */ return tree->left->left; @@ -4687,8 +4691,7 @@ decorateType (ast * tree, RESULT_TYPE resultType) printFromToType(RTYPE(tree), LTYPE(tree)); } - TETYPE (tree) = getSpec (TTYPE (tree) = - LTYPE (tree)); + TETYPE (tree) = getSpec (TTYPE (tree) = LTYPE (tree)); RRVAL (tree) = 1; LLVAL (tree) = 1; if (!tree->initMode ) { @@ -4794,7 +4797,7 @@ decorateType (ast * tree, RESULT_TYPE resultType) decorateType (newNode (CAST, newAst_LINK (copyLinkChain (currFunc->type->next)), tree->right), - RESULT_TYPE_NONE); + IS_GENPTR (currFunc->type->next) ? RESULT_TYPE_GPTR : RESULT_TYPE_NONE); } RRVAL (tree) = 1;