https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80042
--- Comment #9 from Peter Damianov <peter0x44 at disroot dot org> --- Unfortunately my patch causes ICEs in functions that optimize separate sin+cos calls to sincos/cexpi, for reasons I'm not completely sure of. Like the following: typedef struct { float x,y; } Vector2; // Rotate vector by angle Vector2 Vector2Rotate(Vector2 v, float angle) { Vector2 result = { 0 }; float cosres = cosf(angle); float sinres = sinf(angle); result.x = v.x*cosres - v.y*sinres; result.y = v.x*sinres + v.y*cosres; return result; } gcc internally optimizes this to a call to the cexpi builtin, and then that builtin "evaluates" to sincos later (for targets which have it), otherwise cexpi is used (which does not set errno). Guarding this transformation behind -fno-math-errno probably would work, but it would also unnecessarily pessimize the above code into separate sin and cos calls. I think fixing this properly requires expanding the sincos builtin to be able to emit separate sin and cos calls for targets which don't have sincos, and then optimizing to sincos for the case of -fmath-errno.