Fix sincosf -> sincosf recursion

(cherry picked from commit ff4a56e1f49d950e522066e67c64951748a01cb5)

Change-Id: Idbe25881ed66e26395126a80b55c6f4dbc1f0e29
diff --git a/src/sincos.c b/src/sincos.c
index 520aa7b..1c77f58 100644
--- a/src/sincos.c
+++ b/src/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")
+
 /*
  * This file is almost the same as bionic/libm/sincos.c except
  * we declare the function to have hiddlen visibility.  The library