diff options
author | Szabolcs Nagy <nsz@port70.net> | 2014-04-11 17:57:30 +0200 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2014-04-16 02:46:05 -0400 |
commit | 67dc1f311646c50f3f1c281b7c345bb45401f17d (patch) | |
tree | 560c264c0731b725520baf2230805116bdf71db9 /src/math/sincosl.c | |
parent | 043865cadf1b26ee3a9ccdac3b0d0ca9d380cdad (diff) | |
download | musl-67dc1f311646c50f3f1c281b7c345bb45401f17d.tar.gz musl-67dc1f311646c50f3f1c281b7c345bb45401f17d.tar.xz musl-67dc1f311646c50f3f1c281b7c345bb45401f17d.zip |
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. (cherry picked from commit 73c870ed3209b68b5c8c350534508cc9d95a6bcb)
Diffstat (limited to 'src/math/sincosl.c')
-rw-r--r-- | src/math/sincosl.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/math/sincosl.c b/src/math/sincosl.c index 2c600801..d3ac1c4c 100644 --- a/src/math/sincosl.c +++ b/src/math/sincosl.c @@ -4,7 +4,10 @@ #if LDBL_MANT_DIG == 53 && LDBL_MAX_EXP == 1024 void sincosl(long double x, long double *sin, long double *cos) { - sincos(x, (double *)sin, (double *)cos); + double sind, cosd; + sincos(x, &sind, &cosd); + *sin = sind; + *cos = cosd; } #elif (LDBL_MANT_DIG == 64 || LDBL_MANT_DIG == 113) && LDBL_MAX_EXP == 16384 void sincosl(long double x, long double *sin, long double *cos) |