Hi,

The problem appears in revision 201034 in version 4.9.  I attached a
one-line patch that fixes it.  I also reported this problem
at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57806

I bootstrapped and ran the regression tests for this patch on x86_64-linux
and all tests pass.

In method "propagate_nothrow()" in gcc/ipa-pure-const.c, the loop on line
1432 should break immediately after "can_throw" is set to "true". All the
iterations after "can_throw" set to "true" do not perform any useful work,
at best they just set "can_throw" again to "true".

Index: gcc/ipa-pure-const.c
===================================================================
--- gcc/ipa-pure-const.c        (revision 201034)
+++ gcc/ipa-pure-const.c        (working copy)
@@ -1431,7 +1431,10 @@
            }
           for (ie = node->indirect_calls; ie; ie = ie->next_callee)
            if (ie->can_throw_external)
-             can_throw = true;
+             {
+               can_throw = true;
+               break;
+             }
          w_info = (struct ipa_dfs_info *) w->symbol.aux;
          w = w_info->next_cycle;
        }


-Chang
Index: gcc/ipa-pure-const.c
===================================================================
--- gcc/ipa-pure-const.c        (revision 201034)
+++ gcc/ipa-pure-const.c        (working copy)
@@ -1431,7 +1431,10 @@
            }
           for (ie = node->indirect_calls; ie; ie = ie->next_callee)
            if (ie->can_throw_external)
-             can_throw = true;
+             {
+               can_throw = true;
+               break;
+             }
          w_info = (struct ipa_dfs_info *) w->symbol.aux;
          w = w_info->next_cycle;
        }

Reply via email to