va_arg *, and why not.
Geoff Keating
geoffk@cygnus.com
Sun Jul 16 18:23:00 GMT 2000
Hi Gabriel,
at lines 910, 1425, and 1488, diagnostic.c does things like:
static void
output_do_verbatim (buffer, msg, args)
output_buffer *buffer;
const char *msg;
va_list args;
{
...
output_buffer_ptr_to_format_args (buffer) = &args;
}
This is not portable. It doesn't do what you want on machines where
va_list is an array type. Instead of a pointer to a va_list, you get
a pointer to a pointer to a va_list[0], which is not the same thing.
Normally, you would use va_copy to work around this, by writing
va_list tmp_args;
va_copy (tmp_args, args);
output_buffer_ptr_to_format_args (buffer) = &tmp_args;
or better would make output_buffer contain a real va_list, but you
can't do this in gcc, because it's not portable to old compilers.
You'll have to either:
1. implement va_copy, by using an autoconf test to determine whether
or not va_list is an array type; or
2. only pass around va_list *.
This breaks the bootstrap on powerpc-linux.
--
- Geoffrey Keating <geoffk@cygnus.com>
More information about the Gcc-bugs
mailing list