diff options
author | David S. Miller <davem@davemloft.net> | 2014-12-19 13:34:30 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-12-19 13:45:31 -0800 |
commit | 0d4ba8be9cd4cebcc2418c72c22a12fc9baf2c85 (patch) | |
tree | 12ce53b97e81fd29b13d7f9cb4ffc68a9e051299 | |
parent | 6d4188dd7fe4fd7b9aeac91eab4e3c259538106d (diff) | |
download | glibc-0d4ba8be9cd4cebcc2418c72c22a12fc9baf2c85.zip glibc-0d4ba8be9cd4cebcc2418c72c22a12fc9baf2c85.tar.gz glibc-0d4ba8be9cd4cebcc2418c72c22a12fc9baf2c85.tar.bz2 |
Fix soft-fp build warning on sparc about strict aliasing.
* sysdeps/sparc/sparc32/soft-fp/q_neg.c (_Q_neg): Use a union to
access the quad as both a long double and as a series of 4 words.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | sysdeps/sparc/sparc32/soft-fp/q_neg.c | 17 |
2 files changed, 14 insertions, 6 deletions
@@ -1,5 +1,8 @@ 2014-12-19 David S. Miller <davem@davemloft.net> + * sysdeps/sparc/sparc32/soft-fp/q_neg.c (_Q_neg): Use a union to + access the quad as both a long double and as a series of 4 words. + * get-dynamic-info.h (elf_get_dynamic_info): Ignore -Warray-bounds for a link_map->l_info array access. diff --git a/sysdeps/sparc/sparc32/soft-fp/q_neg.c b/sysdeps/sparc/sparc32/soft-fp/q_neg.c index b5049cd..5fb7e1a 100644 --- a/sysdeps/sparc/sparc32/soft-fp/q_neg.c +++ b/sysdeps/sparc/sparc32/soft-fp/q_neg.c @@ -24,20 +24,25 @@ long double _Q_neg(const long double a) { - long double c = a; + union { + long double ldbl; + UWtype words[4]; + } c; + + c.ldbl = a; #if (__BYTE_ORDER == __BIG_ENDIAN) - ((UWtype *)&c)[0] ^= (((UWtype)1) << (W_TYPE_SIZE - 1)); + c.words[0] ^= (((UWtype)1) << (W_TYPE_SIZE - 1)); #elif (__BYTE_ORDER == __LITTLE_ENDIAN) && (W_TYPE_SIZE == 64) - ((UWtype *)&c)[1] ^= (((UWtype)1) << (W_TYPE_SIZE - 1)); + c.words[1] ^= (((UWtype)1) << (W_TYPE_SIZE - 1)); #elif (__BYTE_ORDER == __LITTLE_ENDIAN) && (W_TYPE_SIZE == 32) - ((UWtype *)&c)[3] ^= (((UWtype)1) << (W_TYPE_SIZE - 1)); + c.words[3] ^= (((UWtype)1) << (W_TYPE_SIZE - 1)); #else FP_DECL_Q(A); FP_DECL_Q(C); FP_UNPACK_RAW_Q(A, a); FP_NEG_Q(C, A); - FP_PACK_RAW_Q(c, C); + FP_PACK_RAW_Q(c.ldbl, C); #endif - return c; + return c.ldbl; } |