From: Bruno Haible Date: Sat, 17 Mar 2007 20:07:01 +0000 (+0000) Subject: Fix a portability problem on x86. X-Git-Tag: cvs-readonly~753 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=c3c8fb8fd5880613c2aa14bae661652b3610eadd;p=gnulib.git Fix a portability problem on x86. --- diff --git a/ChangeLog b/ChangeLog index 985a34be5..9902b2518 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2007-03-17 Bruno Haible + * lib/vasnprintf.c (VASNPRINTF): Clear out the memory used for arg_mem + before comparing it. Needed because on some platforms (e.g. x86) a + 'long double' occupies less bytes than sizeof (long double). + +2007-03-17 Bruno Haible + * tests/test-crc.c (main): Make printf statements 64-bit clean. * tests/test-gc-pbkdf2-sha1.c (main): Likewise. * tests/test-getaddrinfo.c (simple): Likewise. diff --git a/lib/vasnprintf.c b/lib/vasnprintf.c index 34d2a4687..b13dbd5ee 100644 --- a/lib/vasnprintf.c +++ b/lib/vasnprintf.c @@ -419,7 +419,9 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar { /* Distinguish 0.0L and -0.0L. */ static long double plus_zero = 0.0L; - long double arg_mem = arg; + long double arg_mem; + memset (&arg_mem, 0, sizeof (long double)); + arg_mem = arg; if (memcmp (&plus_zero, &arg_mem, sizeof (long double)) != 0) { sign = -1; @@ -567,7 +569,9 @@ VASNPRINTF (CHAR_T *resultbuf, size_t *lengthp, const CHAR_T *format, va_list ar { /* Distinguish 0.0 and -0.0. */ static double plus_zero = 0.0; - double arg_mem = arg; + double arg_mem; + memset (&arg_mem, 0, sizeof (double)); + arg_mem = arg; if (memcmp (&plus_zero, &arg_mem, sizeof (double)) != 0) { sign = -1;