[PATCH] missing va_end() in some IO functions (gmp 6.1.2)
Torbjörn Granlund
tg at gmplib.org
Thu Mar 14 11:38:13 UTC 2019
My bad, part of Jakub's patch is needed for standards compliance.
In gmp-impl.h, we have this:
/* va_copy is standard in C99, and gcc provides __va_copy when in strict C89
mode. Falling back to a memcpy will give maximum portability, since it
works no matter whether va_list is a pointer, struct or array. */
#if ! defined (va_copy) && defined (__va_copy)
#define va_copy(dst,src) __va_copy(dst,src)
#endif
#if ! defined (va_copy)
#define va_copy(dst,src) \
do { memcpy (&(dst), &(src), sizeof (va_list)); } while (0)
#endif
We still support ISO C90 (alias ANSI C89) so we cannot just scrap that
code. That means that we mustn't call va_end when memcpy was used by
means of the code above.
I won't put this at the top of my TODO list. Making the GMP code more
complex for the sake of standard complience is much less important than
making GMP work on existing systems.
Is stdarg.h va_end non-empty anywhere?
--
Torbjörn
Please encrypt, key id 0xC8601622
More information about the gmp-bugs
mailing list