Promote varargs pointers to RESULT_TYPE_GPTR
authorKeith Packard <keithp@keithp.com>
Wed, 29 Apr 2009 15:06:31 +0000 (08:06 -0700)
committerKeith Packard <keithp@keithp.com>
Wed, 29 Apr 2009 15:10:23 +0000 (08:10 -0700)
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.

src/SDCCast.c

index 391408318222ae2d9a396d048770554239edceaf..0ec893b325ca6bdc95ef66031acf72ec2e31fbd4 100644 (file)
@@ -863,6 +863,8 @@ processParms (ast *func,
 
       ftype = (*actParm)->ftype;
 
 
       ftype = (*actParm)->ftype;
 
+      resultType = RESULT_TYPE_NONE;
+
       /* If it's a char, upcast to int. */
       if (IS_INTEGRAL (ftype)
           && (getSize (ftype) < (unsigned) INTSIZE))
       /* 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;
         {
           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;
         }
 
       if (IS_AGGREGATE (ftype))
         {
           newType = newAst_LINK (copyLinkChain (ftype));
           DCL_TYPE (newType->opval.lnk) = port->unqualified_pointer;
+         resultType = RESULT_TYPE_GPTR;
         }
 
       if (newType)
         }
 
       if (newType)
@@ -890,7 +894,7 @@ processParms (ast *func,
           (*actParm)->filename = (*actParm)->right->filename;
           (*actParm)->lineno = (*actParm)->right->lineno;
 
           (*actParm)->filename = (*actParm)->right->filename;
           (*actParm)->lineno = (*actParm)->right->lineno;
 
-          decorateType (*actParm, RESULT_TYPE_NONE);
+          decorateType (*actParm, resultType);
         }
       return 0;
     } /* vararg */
         }
       return 0;
     } /* vararg */