Hi!

As mentioned on IRC, operation_could_trap_helper_p returns true
for division or modulo with -ftrapv; the operations could trap in certain
cases (e.g. division by -1 of minimum signed value, but we don't have any
library functions for division/modulo for -ftrapv nor instrument it in any
way).  The following just makes it match what we implement.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2018-02-06  Jakub Jelinek  <ja...@redhat.com>

        * tree-eh.c (operation_could_trap_helper_p): Ignore honor_trapv for
        *DIV_EXPR and *MOD_EXPR.

--- gcc/tree-eh.c.jj    2018-02-01 11:07:24.000000000 +0100
+++ gcc/tree-eh.c       2018-02-03 17:52:40.573255559 +0100
@@ -2436,7 +2436,7 @@ operation_could_trap_helper_p (enum tree
     case ROUND_MOD_EXPR:
     case TRUNC_MOD_EXPR:
     case RDIV_EXPR:
-      if (honor_snans || honor_trapv)
+      if (honor_snans)
        return true;
       if (fp_operation)
        return flag_trapping_math;

        Jakub

Reply via email to