diff --git a/libm/sincos.c b/libm/sincos.c index 116b151e2..e9f6dcc58 100644 --- a/libm/sincos.c +++ b/libm/sincos.c @@ -27,6 +27,14 @@ #define _GNU_SOURCE 1 #include +// 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);