Subject: Re: va_list pointers, bad(?) gcc code
To: Frank van der Linden <email@example.com>
From: Michal Ludvig <firstname.lastname@example.org>
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.
sUsE cR, s.R.o email@example.com | Cray is the only computer
(+420) 296.545.373 http://www.suse.cz | that runs an endless loop
Personal homepage http://www.logix.cz/~mic | in just four hours.