On Thu, 4 Oct 2018, Richard Biener wrote: > So it means that GCC may elide errno setting (by inlining a function for > example) but otherwise assume nothing else?
Yes, on systems where libm functions do in fact set errno (but it can also assume that only the actual errno variable is clobbered, not e.g. some random int in the middle of your array). (It would be possible to have libm function variants that explicitly guarantee not to set errno, if there are particular functions for which having such variants is useful to e.g. the vectorizer, but it would of course be a property of the libm implementation whether such variants are available and for what functions.) There could be a variant option that does mean "libm functions are not called with arguments that make them set errno", and -ffast-math could imply that (-ffinite-math-only doesn't, because e.g. underflow is consistent with -ffinite-math-only but can result in errno setting). Or you could say -fno-math-errno is that variant option, but the thing enabled by default is the weaker option meaning "may or may not set errno" (but if Darwin libm indeed never sets errno, the stronger version should be enabled by default there). -- Joseph S. Myers jos...@codesourcery.com