diff options
author | Jakub Jelinek <jakub@redhat.com> | 2013-12-31 12:57:39 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2013-12-31 12:57:39 +0100 |
commit | cf3e5a89aecd15ead7177517b7f3b6e3c4c66645 (patch) | |
tree | 5d6617e32d36fdd5d7a923056f3a99a087058e44 /gcc | |
parent | c1618f825445027dd466e6db27b26dfa9b5899d7 (diff) | |
download | gcc-cf3e5a89aecd15ead7177517b7f3b6e3c4c66645.zip gcc-cf3e5a89aecd15ead7177517b7f3b6e3c4c66645.tar.gz gcc-cf3e5a89aecd15ead7177517b7f3b6e3c4c66645.tar.bz2 |
re PR tree-optimization/59622 (internal compiler error: verify_gimple failed)
PR tree-optimization/59622
* gimple-fold.c (gimple_fold_call): Don't replace OBJ_TYPE_REF
call fndecl with 0 possible targets with BUILT_IN_UNREACHABLE,
instead only for !inplace add a __builtin_unreachable () call
before the call.
* g++.dg/opt/pr59622.C: New test.
From-SVN: r206264
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/gimple-fold.c | 18 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/opt/pr59622.C | 19 |
4 files changed, 44 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7ce8001..73c4762 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2013-12-31 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/59622 + * gimple-fold.c (gimple_fold_call): Don't replace OBJ_TYPE_REF + call fndecl with 0 possible targets with BUILT_IN_UNREACHABLE, + instead only for !inplace add a __builtin_unreachable () call + before the call. + 2013-12-31 Alexander Ivchenko <alexander.ivchenko@intel.com> Maxim Kuznetsov <maxim.kuznetsov@intel.com> Sergey Lega <sergey.s.lega@intel.com> diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 3b6fc57..1d9d824 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -1184,13 +1184,19 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool inplace) = possible_polymorphic_call_targets (callee, &final); if (final && targets.length () <= 1) { - tree fndecl; if (targets.length () == 1) - fndecl = targets[0]->decl; - else - fndecl = builtin_decl_implicit (BUILT_IN_UNREACHABLE); - gimple_call_set_fndecl (stmt, fndecl); - changed = true; + { + gimple_call_set_fndecl (stmt, targets[0]->decl); + changed = true; + } + else if (!inplace) + { + tree fndecl = builtin_decl_implicit (BUILT_IN_UNREACHABLE); + gimple new_stmt = gimple_build_call (fndecl, 0); + gimple_set_location (new_stmt, gimple_location (stmt)); + gsi_insert_before (gsi, new_stmt, GSI_SAME_STMT); + return true; + } } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 46d5c13..1ad8186 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-12-31 Jakub Jelinek <jakub@redhat.com> + + PR tree-optimization/59622 + * g++.dg/opt/pr59622.C: New test. + 2013-12-31 Alexander Ivchenko <alexander.ivchenko@intel.com> Maxim Kuznetsov <maxim.kuznetsov@intel.com> Sergey Lega <sergey.s.lega@intel.com> diff --git a/gcc/testsuite/g++.dg/opt/pr59622.C b/gcc/testsuite/g++.dg/opt/pr59622.C new file mode 100644 index 0000000..1d8e998 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr59622.C @@ -0,0 +1,19 @@ +// PR tree-optimization/59622 +// { dg-do compile } +// { dg-options "-O2" } + +namespace +{ + struct A + { + virtual int foo (); + int bar () { return foo (); } + }; +} + +int +baz () +{ + A a; + return a.bar (); +} |