summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);