On 2019-03-14 12:38:13 +0100, Torbjorn Granlund wrote:
> 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.
But will va_arg necessarily work when va_copy is just a memcpy
(at least in the case where va_end is *not* empty)? This seems
optimistic.
--
Vincent Lefèvre <[email protected]> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
_______________________________________________
gmp-bugs mailing list
[email protected]
https://gmplib.org/mailman/listinfo/gmp-bugs