From a88bf705531216cbdb8637836caf2b228d49d175 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 4 Dec 2013 09:44:25 +0100 Subject: [PATCH] re PR tree-optimization/59355 (ICE: SIGSEGV in hash_table::find_slot_with_hash() with -fno-devirtualize) PR tree-optimization/59355 * ipa-devirt.c (gate_ipa_devirt): Return false if !flag_devirtualize. * opts.c (common_handle_option): Fix comment spelling. * g++.dg/ipa/pr59355.C: New test. From-SVN: r205656 --- gcc/ChangeLog | 7 +++++++ gcc/ipa-devirt.c | 6 ++++-- gcc/opts.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/ipa/pr59355.C | 14 ++++++++++++++ 5 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ipa/pr59355.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0e947b7..92a8651 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2013-12-04 Jakub Jelinek + + PR tree-optimization/59355 + * ipa-devirt.c (gate_ipa_devirt): Return false if + !flag_devirtualize. + * opts.c (common_handle_option): Fix comment spelling. + 2013-12-04 Yufeng Zhang * gimple-ssa-strength-reduction.c: Include tree-affine.h. diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 4c4e7a5..7452828 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -1591,12 +1591,14 @@ ipa_devirt (void) return ndevirtualized ? TODO_remove_functions : 0; } -/* Gate for IPCP optimization. */ +/* Gate for speculative IPA devirtualization optimization. */ static bool gate_ipa_devirt (void) { - return flag_devirtualize_speculatively && optimize; + return (flag_devirtualize + && flag_devirtualize_speculatively + && optimize); } namespace { diff --git a/gcc/opts.c b/gcc/opts.c index 0c1f57e..a0a6c53 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -1709,7 +1709,7 @@ common_handle_option (struct gcc_options *opts, if (!opts_set->x_flag_tree_loop_distribute_patterns) opts->x_flag_tree_loop_distribute_patterns = value; /* Indirect call profiling should do all useful transformations - speculative devirutalization does. */ + speculative devirtualization does. */ if (!opts_set->x_flag_devirtualize_speculatively && opts->x_flag_value_profile_transformations) opts->x_flag_devirtualize_speculatively = false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index dcc02b5..e358541 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-12-04 Jakub Jelinek + + PR tree-optimization/59355 + * g++.dg/ipa/pr59355.C: New test. + 2013-12-04 Yufeng Zhang * gcc.dg/tree-ssa/slsr-39.c: Update. diff --git a/gcc/testsuite/g++.dg/ipa/pr59355.C b/gcc/testsuite/g++.dg/ipa/pr59355.C new file mode 100644 index 0000000..907c6d7 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/pr59355.C @@ -0,0 +1,14 @@ +// PR tree-optimization/59355 +// { dg-do compile } +// { dg-options "-O2 -fno-devirtualize" } + +struct S +{ + virtual void bar (); +}; + +void +foo (S *s) +{ + s->bar (); +} -- 2.7.4