[Bug middle-end/85992] Invalid optimization with atanf

2018-05-30 Thread mpeddie at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85992

--- Comment #4 from Matt Peddie  ---
-fno-builtin-atanf does the trick.  Thanks, Marc.

[Bug middle-end/85992] Invalid optimization with atanf

2018-05-30 Thread glisse at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85992

--- Comment #3 from Marc Glisse  ---
(In reply to Matt Peddie from comment #2)
> Is there a way to disable this behavior?

-fno-builtin (or a more specific -fno-builtin-atanf) tells gcc to handle atanf
as a regular function call, not as a standard function, so it should avoid
constant folding (I didn't check).

[Bug middle-end/85992] Invalid optimization with atanf

2018-05-30 Thread mpeddie at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85992

--- Comment #2 from Matt Peddie  ---
Thank you for your quick response.  The explanation makes sense, and I agree
this is not a bug.  I'd like to understand -- this seems to me to imply that
GCC will use MPFR to evaluate calls to libm functions even when optimizations
are disabled with -O0, since in the -O0 case I still get the MPFR result if I
don't use a separate function and call atanf() on a constant.  Is there a way
to disable this behavior?

[Bug middle-end/85992] Invalid optimization with atanf

2018-05-30 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85992

Richard Biener  changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution|--- |INVALID

--- Comment #1 from Richard Biener  ---
You get the runtime value computed by libm when not optimizing and the mpfr
result when GCC applies constant folding.

Iff then this is a libm bug not providing an exact result - but this is
expected as you are dealing with FP.