Article View: gnu.gcc.help
Article #42887Re: Problems with varargs on sun4
From: Eric Norum
Date: Thu, 12 Oct 1995 00:00
Date: Thu, 12 Oct 1995 00:00
30 lines
1458 bytes
1458 bytes
Johnathan Gratch (gratch) wrote:
: Hi, I am having core dumps when using varargs with gcc on a sparc20
: running sun4.1.3. I notice a previous posting with a similar problem
: but no responses. The problem doesn't seem to occur on other machines
: or when using other compilers.
: int var_fun(va_alist)
: va_dcl
: {
: va_list ap;
: short arg1;
: double arg2;
: va_start(ap);
: arg1 = va_arg(ap, short); /* this value is now zero */
^^^^^
This is illegal. Variable arguments, like
arguments to a function with no prototype in
scope, undergo `promotion' so you can't use
`char', `short', or `float' here.
BTW, why not use ANSI-style variable argument lists (stdarg.h)?
--
Eric Norum eric@skatter.usask.ca
Saskatchewan Accelerator Laboratory Phone: (306) 966-6308
University of Saskatchewan FAX: (306) 966-6058
Saskatoon, Canada. NeXTMail accepted.
Technical Details
Message-ID:
<45i0em$8nk@tribune.usask.ca>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<45hcoq$fvp@venera.isi.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,49746454ab2e3ad4 X-Google-Attributes: gid11318c,public From: eric@skatter.usask.ca (Eric Norum) Subject: Re: Problems with varargs on sun4 Date: 1995/10/12 Message-ID: <45i0em$8nk@tribune.usask.ca> X-Deja-AN: 117461231 references: <45hcoq$fvp@venera.isi.edu> organization: University of Saskatchewan newsgroups: gnu.gcc.help