Article View: gnu.gcc.help
Article #51280Re: vararg problem in sparc ?
From: Brian Jones
Date: Wed, 09 Jun 1993 16:09
Date: Wed, 09 Jun 1993 16:09
57 lines
2017 bytes
2017 bytes
In article <1993Jun8.194057.2074@ods.com> jim@ods.com (Jim Deerman) writes:
>We have run into a problem trying to use
>varargs (passing variable arguments into
>a function) with gcc 2.4.0 on a Sparc10.
>
>This was working correctly on gcc 2.1 and
>works correctly on the IBM RS6000 version
>of gcc 2.4.0.
>
>Has anyone seen this problem and how can
>we get varargs to work on the Sparc ?
>
I am having, probably, much the same problem. Except I am compiling
2.4.3 on an alliant fx2800. vsprintf and vprintf don't want to work.
However, this does work:
#include <stdio.h>
#include <stdarg.h>
/* calculate sum of a 0 terminated list */
void sum(char *msg, ...)
{
int total = 0;
va_list ap;
int arg;
va_start (ap,msg);
while ((arg = va_arg(ap,int)) != 0) {
total += arg;
}
printf(msg,total);
}
main ()
{
sum ("The total of 1+2+3+4 is %d\n", 1,2,3,4,0);
}
As soon as I add a vprintf statement gcc bombs with:
test2.c: In function `sum':
test2.c:10: incompatible type for argument 2 of `vprintf'
Has anybody gotten this to work?
Thanks
Brian Jones
--
==========================================================================
Brian Jones email: brianj@skat.usc.edu
University of Southern Cal bjones@aludra.usc.edu
Computing Services
Technical Details
Message-ID:
<1v5208$9dv@sol.usc.edu>Path:
arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!usc!usc!not-for-mailReferences:
<1993Jun8.194057.2074@ods.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,2dd5f428e98ef434 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-06-09 09:16:51 PST Path: arc1-ca.pugleaf.net!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!usc!usc!not-for-mail From: brianj@sol.usc.edu (Brian Jones) Newsgroups: gnu.gcc.help Subject: Re: vararg problem in sparc ? Date: 9 Jun 1993 09:09:44 -0700 Organization: University Computing Services--U.S.C. Lines: 57 Sender: brianj@sol.usc.edu Message-ID: <1v5208$9dv@sol.usc.edu> References: <1993Jun8.194057.2074@ods.com> NNTP-Posting-Host: sol.usc.edu