summaryrefslogtreecommitdiffstats
path: root/libm
diff options
context:
space:
mode:
authorJing Yu <jingyu@google.com>2011-08-16 16:14:34 -0700
committerJing Yu <jingyu@google.com>2011-08-17 10:29:41 -0700
commitd50225ad20b4510892dc5f2306b64f04bab6e711 (patch)
treeb7680d6ac15903fabb2dc158553960ff9bf80efc /libm
parent6dcf0d73a69e01a9ef1d4d2f1e61cd114c0851a5 (diff)
downloadbionic-d50225ad20b4510892dc5f2306b64f04bab6e711.zip
bionic-d50225ad20b4510892dc5f2306b64f04bab6e711.tar.gz
bionic-d50225ad20b4510892dc5f2306b64f04bab6e711.tar.bz2
Disable sincos optimization for sincos calls.
sincos() functions would be turned into infinite calls to itself if sincos optimization is applied to itself. See gcc bugzilla http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46926 arm-linux-androideabi-4.4.3 toolchain does not have this problem because sincos optimization is entirely disabled. Starting from arm-linux-androideabi-4.6 toolchain, we enable sincos optimization in gcc. This patch simply enforce -O0 on this function to minimize the change. Change-Id: I0fc00b5f1dd71c0a024943bdedfed29b0d195e82
Diffstat (limited to 'libm')
-rw-r--r--libm/sincos.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libm/sincos.c b/libm/sincos.c
index 116b151..e9f6dcc 100644
--- a/libm/sincos.c
+++ b/libm/sincos.c
@@ -27,6 +27,14 @@
#define _GNU_SOURCE 1
#include <math.h>
+// Disable sincos optimization for all functions in this file,
+// otherwise gcc would generate infinite calls.
+// Refer to gcc PR46926.
+// -fno-builtin-sin or -fno-builtin-cos can disable sincos optimization,
+// but these two options do not work inside optimize pragma in-file.
+// Thus we just enforce -O0 when compiling this file.
+#pragma GCC optimize ("O0")
+
void sincos(double x, double *psin, double *pcos)
{
*psin = sin(x);