Subject: Re: va_list pointers, bad(?) gcc code
To: Frank van der Linden <>
From: Michal Ludvig <>
List: port-amd64
Date: 11/11/2003 12:49:12
Frank van der Linden told me that:
> On Tue, Nov 11, 2003 at 11:03:25AM +0100, Michal Ludvig wrote:
>>vfoo1(const char *a, va_list l)
>>         va_list l2;
>>         va_copy (l2, l);
>>         vfoo2(a, &l2);
>>Now it should work...
> I agree that this is better, but the thing is: this is 3rd party code,
> (my test program jut imitates what's in glib 2.2.3), and I think it's
> legal C code.. If it is legal C, then gcc should support it. I'd like to
> find out if it's legal, and if this is considered a bug.

Here is what I got from the guy who ported GCC to AMD64:

---- Jan Hubicka wrote:
The code is illegal.  It is not allowed to take address of va_list type.
The reason why it does not work is that va_list is internally array.
Array's address is first ellement.  However when array is passed as
argument, it is just shortcut for pointer and pointer's address is
pointer to pointer.  So the dereference does not work.

Michal Ludvig
sUsE cR, s.R.o    | Cray is the only computer
(+420) 296.545.373 | that runs an endless loop
Personal homepage | in just four hours.