* Nested stdarg broken?
@ 1999-10-26 23:03 Bob Toxen
1999-10-27 6:08 ` Momchil 'Velco' Velikov
0 siblings, 1 reply; 2+ messages in thread
From: Bob Toxen @ 1999-10-26 23:03 UTC (permalink / raw)
To: linuxppc-dev
My application uses stdarg (#include <stdarg.h>, va_start, and friends)
in a function that then calls vfprintf which also uses stdarg.
The variable args get garbled by the time they get to vfprintf. The
fmt arg does not get garbled.
Note that the documentation specifies that this should work. My application
works fine on Linux on Intel and other platforms. The PowerPC is the first
big endian platform but I am quite sure that the bug is not in my code.
My code (simplified) looks like
#include <stdio.h>
#include <stdarg.h>
logmsg(int out, const char *fmt, ...)
{
FILE *fp;
char *p;
int ret = 0;
char buf[512];
va_list ap; /* May need to be last arg. */
va_start(ap, fmt);
fflush(stdout); /* Flush "the other" output. */
fp = fopen(logfile, "a");
if (!fp || vfprintf(fp, fmt, ap) < 1)
ret = -1;
if (fp && fclose(fp) == EOF)
ret = -1;
va_end(ap);
return ret;
}
THANKS for any insight. Presently I'm IFDEFing it to not use stdargs on
the PowerPC platform.
Bob Toxen
bob@roger.realminfo.com
Error #152, Windows not found: (C)heer, (P)arty, (D)ance
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Nested stdarg broken?
1999-10-26 23:03 Nested stdarg broken? Bob Toxen
@ 1999-10-27 6:08 ` Momchil 'Velco' Velikov
0 siblings, 0 replies; 2+ messages in thread
From: Momchil 'Velco' Velikov @ 1999-10-27 6:08 UTC (permalink / raw)
To: Bob Toxen; +Cc: linuxppc-dev
Bob Toxen wrote:
>
> My application uses stdarg (#include <stdarg.h>, va_start, and friends)
> in a function that then calls vfprintf which also uses stdarg.
>
> The variable args get garbled by the time they get to vfprintf. The
> fmt arg does not get garbled.
Here's what you can read at
http://egcs.cygnus.com/gcc-2.95/gcc-2.95.1.html
under section "Platform specific bugfixes and improvements"
Fix varargs/stdarg code generation bug for rs6000/ppc svr4
targets.
Maybe this helps, maybe not.
Regards,
-velco
btw, 2.95.2 is out
-velco
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1999-10-27 6:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-10-26 23:03 Nested stdarg broken? Bob Toxen
1999-10-27 6:08 ` Momchil 'Velco' Velikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).