From: Keith Packard Date: Wed, 29 Apr 2009 15:06:31 +0000 (-0700) Subject: Promote varargs pointers to RESULT_TYPE_GPTR X-Git-Url: https://git.gag.com/?p=fw%2Fsdcc;a=commitdiff_plain;h=a38f33ebea19e30a1adc71fb457b4002c4c3c787 Promote varargs pointers to RESULT_TYPE_GPTR The addition of the RESULT_TYPE_GPTR as distinct from RESULT_TYPE_NONE was not propogated into the varargs function parameter handling code resulting in non-generic pointers being passed to varargs functions. --- diff --git a/src/SDCCast.c b/src/SDCCast.c index 39140831..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 */