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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2015-03-18 00:00:00         |2019-1-8

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Reconfirmed.  Now needs -ftree-loop-if-convert (which also makes it fail ontop
of -O[12]).

As said, not sure what to do - __builtin_log10 (and others) are const nothrow
with -fno-math-errno -ftrapping-math.  if_convertible_stmt_p does

    case GIMPLE_CALL:
      {
        tree fndecl = gimple_call_fndecl (stmt);
        if (fndecl)
          {
            int flags = gimple_call_flags (stmt);
            if ((flags & ECF_CONST)
                && !(flags & ECF_LOOPING_CONST_OR_PURE)
                /* We can only vectorize some builtins at the moment,
                   so restrict if-conversion to those.  */
                && fndecl_built_in_p (fndecl))
              return true;
          }
        return false;

which fails to consider externally throwing stmts (internal throws would
be rejected by other means).  But 'nothrow' doesn't go away with
-ftrapping-math (which is also the default btw).  logN(0) is documented
to raise FE_DIVBYZERO.

One possibility here is to simply check flag_trapping_math but then
even functions like sin() would be flagged.

Joseph?  How would you arrange things so that those builtin calls are
flagged as possibly trapping (rather than throwing)?  We could add
a built_in_could_trap_p helper, explicitely spelling out things.
I think there's no function attribute glibc could place on a
function to say it won't ever trap?  (even sin() is documented to
trap on +-Inf)

Reply via email to