This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [3.3/mainline;libiberty] Fix vasprintf.c
> If it is an array, isn't passing by value and THEN copying
> it (again) a waste of cpu time?
This file (vasprintf.c) is not usually used because glibc provides vasprintf().
Anyway, leaving the function as
static int int_vasprintf PARAMS ((char **, const char *, va_list *));
int
vasprintf (result, format, args)
char **result;
const char *format;
#if defined (_BSD_VA_LIST_) && defined (__FreeBSD__)
_BSD_VA_LIST_ args;
#else
va_list args;
#endif
{
return int_vasprintf (result, format, &args);
}
causes this warning:
vas.c:158: warning: passing arg 3 of `int_vasprintf' from incompatible pointer type
so using "&args" is apparently wrong on x86-64 and ppc64.
Jan's patch fixes vasprintf.c, GCC writes no warnings while compiling on
all platforms I tested, the test contained in the file works without
segfaulting (without the patch it segfaults).
Josef