Bootstrap failure (Re: [Patch] Java: Prepare for %q, %< and %> in diagnostic messages)

Gabriel Dos Reis gdr@cs.tamu.edu
Wed Oct 6 14:56:00 GMT 2004


Zack Weinberg <zack@codesourcery.com> writes:

| Andrew Haley <aph@redhat.com> writes:
| 
| >  > Uh, can you do this?  Take an address of a va_list object?

Yes.  Would you not?  It is an object type.  And you can take the
address of any object (ignoring register).

| >
| > It says in 7.15 "va_list is an object type".  So, you can take its
| > address and later dereference to get an lvalue that is a va_list.
| >
| >  > Wouldn't it be more "correct" to have text.args_ptr be of type
| >  > va_list and use va_copy instead?
| >
| > That does sound like a better idea, yes.
| 
| We can't count on having va_copy, it's only in C99.
| 
| Taking the address of the va_list *in the function that called
| va_start*, passing that around, and dereferencing the pointer only
| as an immediate operand of va_arg, that works reliably.
| 
| Passing the va_list around by value does not work reliably.

I 100% agree with Zack.

For the record, the diagnostic machinery was passing va_list by value
and of course got into troubles.  Which is how we came to the more
portable and reliable pointer to va_list.

-- Gaby



More information about the Gcc-patches mailing list