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
This commit is contained in:
Jing Yu 2011-08-16 16:14:34 -07:00
parent 6dcf0d73a6
commit d50225ad20

View file

@ -27,6 +27,14 @@
#define _GNU_SOURCE 1 #define _GNU_SOURCE 1
#include <math.h> #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) void sincos(double x, double *psin, double *pcos)
{ {
*psin = sin(x); *psin = sin(x);