Subject: Re: va_list pointers, bad(?) gcc code
To: Martin Husemann <martin@duskware.de>
From: Michal Ludvig <mludvig@suse.cz>
List: tech-toolchain
Date: 11/11/2003 11:35:47
Martin Husemann told me that:
> On Tue, Nov 11, 2003 at 11:13:25AM +0100, Michal Ludvig wrote:
>
>>#define va_copy __builtin_va_copy
>
> There is no va_copy used in the test program, so why does this make a
> differnece?
As I said in my first e-mail, replace:
void
vfoo1(const char *a, va_list l)
{
vfoo2(a, &l);
}
with
void
vfoo1(const char *a, va_list l)
{
va_list l2;
va_copy (l2, l);
vfoo2(a, &l2);
}
Here I introduce va_copy().
AFAIK there is something magic with passing vararg parameters to
functions, but I don't know the exact reasoning why this change is
necessry. At least it fixes the crash ;-)
Michal Ludvig
--
sUsE cR, s.R.o mludvig@suse.cz | 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.