From 68cdbb18dac8d6cc6990e1de7b4f481ccbbfcd1d Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 16 Jun 2005 19:14:01 +0000 Subject: 2005-06-16 Christopher Faylor * libc/stdio/vfprintf.c (cvt): Don't rely on pointer aliasing to determine characteristics of long double. Use a union instead. * ldtoa.c (_ldtoa_r): Ditto. (_ldcheck): Ditto. (_strtold): Ditto. (union uconv): New union. --- newlib/libc/stdio/vfprintf.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'newlib/libc/stdio/vfprintf.c') diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index c10fed8e9..c51b6b821 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -1260,7 +1260,11 @@ _DEFUN(cvt, (data, value, ndigits, flags, sign, decpt, ch, length), #ifdef _NO_LONGDBL union double_union tmp; #else - struct ldieee *ldptr; + union + { + struct ldieee ieee; + _LONG_DOUBLE val; + } ld; #endif if (ch == 'f') { @@ -1287,8 +1291,8 @@ _DEFUN(cvt, (data, value, ndigits, flags, sign, decpt, ch, length), digits = _dtoa_r (data, value, mode, ndigits, decpt, &dsgn, &rve); #else /* !_NO_LONGDBL */ - ldptr = (struct ldieee *)&value; - if (ldptr->sign) { /* this will check for < 0 and -0.0 */ + ld.val = value; + if (ld.ieee.sign) { /* this will check for < 0 and -0.0 */ value = -value; *sign = '-'; } else -- cgit v1.2.3