From 73c870ed3209b68b5c8c350534508cc9d95a6bcb Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Fri, 11 Apr 2014 17:57:30 +0200 Subject: math: fix aliasing violation in long double wrappers modfl and sincosl were passing long double* instead of double* to the wrapped double precision functions (on archs where long double and double have the same size). This is fixed now by using temporaries (this is not optimized to a single branch so the generated code is a bit bigger). Found by Morten Welinder. --- src/math/modfl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/math/modfl.c') diff --git a/src/math/modfl.c b/src/math/modfl.c index f736bba4..4b03a4be 100644 --- a/src/math/modfl.c +++ b/src/math/modfl.c @@ -3,7 +3,12 @@ #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 long double modfl(long double x, long double *iptr) { - return modf(x, (double *)iptr); + double d; + long double r; + + r = modf(x, &d); + *iptr = d; + return r; } #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 #if LDBL_MANT_DIG == 64 -- cgit v1.2.1