Article View: gnu.gcc.bug
Article #1264stdarg/varargs and the v?printf's on HP700
From: Steve Preston
Date: Tue, 06 Oct 1992 14:40
Date: Tue, 06 Oct 1992 14:40
38 lines
1697 bytes
1697 bytes
HP9000/720 HPUX 8.07 gcc 2.2.2 (configured for hppa1.1-hp-hpux)
This is really HP's fault, I would guess.
The GNU C compiler defines its own version of stdarg/varargs data
structures, defining the type va_list as a structure of pointers,
thusly:
typedef struct
{
char *__va_stack_start; /* Real start of stack args. */
char *__va_int; /* Pointer to the general register */
/* args and stack. */
char *__va_float; /* Pointer to the fp register args. */
char *__va_double;
} va_list;
In the HPUX headers, the v?printf's are declared to take the type
__va_list which is typedef'ed as a pointer to double. So any calls to
v?printf either cause a compile error or fail badly at runtime.
I have experimentally determined that one should pass the __va_int
member to v?printf, (cast as a (double *) or (__va_list) to suppress a
warning, if desired).
This perhaps could be fixed by including a set of macros such as
#define vprintf(a,b) vprintf(a,(__va_list)(b).__va_int)
to the gnu include files. Except that would interfere with the
declaration of vprintf in stdio.h.
A better fix would be to write vprintf et.al., using _doprnt, which
HP's libc apparently contains, to do the work.
--
Steve Preston (scp2@gte.com)
Technical Details
Message-ID:
<9210062259.AA01023@bunny.gte.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!gte.com!steve%eowynShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!gte.com!steve%eowyn From: steve%eowyn@gte.com (Steve Preston) Subject: stdarg/varargs and the v?printf's on HP700 Message-ID: <9210062259.AA01023@bunny.gte.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 6 Oct 1992 14:40:47 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 39