https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64225

--- Comment #8 from joseph at codesourcery dot com <joseph at codesourcery dot 
com> ---
Expanding x * x (or any such multiplication) to a call to pow is 
inherently dubious because the semantics of multiplication never include 
clobbering errno, though maybe it's OK with -funsafe-math-optimizations to 
introduce such a clobber.

I think it would be useful to have no-errno-setting-needed versions of 
libm function builtins that users can call explicitly, as well as for 
internal use by GCC when it generates a built-in function call from code 
that doesn't set errno.

(For example: glibc uses __builtin_fma to expand to an fma instruction 
when _FP_FAST_FMA indicates one is available.  But strictly it's incorrect 
to expand fma / __builtin_fma calls to such an instruction without 
considering errno, unless -fno-math-errno.  None of those glibc uses 
require fma to set errno (and glibc fma has its own bug where it fails to 
do so), so it would be beneficial to have __builtin_fma_noerrno to reflect 
what's actually required - this function would expand inline if possible, 
and failing that would call an fma function that might or might not end up 
settting errno.)

Reply via email to