This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
Re: c/9700: va_start gets __offset wrong in some situations
- From: bangerth at dealii dot org
- To: agriffis at gentoo dot org, bjb at gentoo dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, msterret at coat dot com, nobody at gcc dot gnu dot org, wwoods at gentoo dot org
- Date: 15 Feb 2003 00:14:24 -0000
- Subject: Re: c/9700: va_start gets __offset wrong in some situations
- Reply-to: bangerth at dealii dot org, agriffis at gentoo dot org, bjb at gentoo dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, msterret at coat dot com, nobody at gcc dot gnu dot org, wwoods at gentoo dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: va_start gets __offset wrong in some situations
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Sat Feb 15 00:14:24 2003
State-Changed-Why:
Not a bug. The man page says:
The first use of the va_arg macro after that of the
va_start macro returns the argument after last. Succes
sive invocations return the values of the remaining argu
ments.
You also get the "two" from this small example:
#include <stdarg.h>
void func(const char *first_custom,
...)
{
char *s;
va_list custom_args;
va_start (custom_args, first_custom);
s = va_arg(custom_args, char *);
printf ("%s\n", s);
va_end (custom_args);
}
int main() {
func("one", "two", "three");
}
(also on Linux). Given the description on the man page,
this is not surprising.
W.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9700