diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-08-26 08:48:37 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2009-08-26 08:48:37 +0000 |
commit | 8e03163767dc9971a3bcebbd36abb4fefb526815 (patch) | |
tree | e0421a45da38fdf64f50113acb5ff5b73b70e7de /set_ld.c | |
parent | ae225a5f36f45a8de0640edfb7d8f1b493efffb8 (diff) | |
download | mpfr-8e03163767dc9971a3bcebbd36abb4fefb526815.tar.gz |
set_ld.c: replaced a struct by a union. The struct was triggering the
following warning with GCC 4.4:
dereferencing type-punned pointer will break strict-aliasing rules
(possibly due to possible memory alignment problems). The old code
looked strange anyway and unions are exactly for such kind of things.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@6381 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'set_ld.c')
-rw-r--r-- | set_ld.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -32,15 +32,15 @@ http://www.gnu.org/licenses/ or write to the Free Software Foundation, Inc., has been seen with the problem, and gcc 2.95.4 on FreeBSD 4.7. */ #if HAVE_LDOUBLE_IEEE_EXT_LITTLE -static const struct { +static const union { char bytes[10]; - long double dummy; /* for memory alignment */ + long double d; } ldbl_max_struct = { { '\377','\377','\377','\377', '\377','\377','\377','\377', - '\376','\177' }, 0.0 + '\376','\177' } }; -#define MPFR_LDBL_MAX (* (const long double *) ldbl_max_struct.bytes) +#define MPFR_LDBL_MAX (ldbl_max_struct.d) #else #define MPFR_LDBL_MAX LDBL_MAX #endif |