From e40323639ede479a58d6575ea770d664e5c6134c Mon Sep 17 00:00:00 2001 From: hubicka Date: Sun, 2 Mar 2014 20:51:48 +0000 Subject: [PATCH] PR ipa/60306 Revert: 2013-12-14 Jan Hubicka PR middle-end/58477 * ipa-prop.c (stmt_may_be_vtbl_ptr_store): Skip clobbers. * testsuite/g++.dg/ipa/devirt-29.C: New testcase git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@208261 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 9 +++++ gcc/ipa-prop.c | 3 +- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/g++.dg/ipa/devirt-29.C | 75 ++++++++++++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/ipa/devirt-29.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4224c014c21f..b6f1dac00ad6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2014-03-02 Jan Hubicka + + PR ipa/60306 + + Revert: + 2013-12-14 Jan Hubicka + PR middle-end/58477 + * ipa-prop.c (stmt_may_be_vtbl_ptr_store): Skip clobbers. + 2014-03-02 Jon Beniston PR bootstrap/48230 diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 368b93b7d4ac..4fb916aa01fd 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -573,8 +573,7 @@ stmt_may_be_vtbl_ptr_store (gimple stmt) { if (is_gimple_call (stmt)) return false; - else if (gimple_clobber_p (stmt)) - return false; + /* TODO: Skip clobbers, doing so triggers problem in PR60306. */ else if (is_gimple_assign (stmt)) { tree lhs = gimple_assign_lhs (stmt); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b292df20cf4d..864057e435d1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-03-02 Jan Hubicka + + PR ipa/60306 + * testsuite/g++.dg/ipa/devirt-29.C: New testcase + 2014-03-02 Bernd Edlinger PR fortran/60236 diff --git a/gcc/testsuite/g++.dg/ipa/devirt-29.C b/gcc/testsuite/g++.dg/ipa/devirt-29.C new file mode 100644 index 000000000000..190d9e2feba9 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/devirt-29.C @@ -0,0 +1,75 @@ +/* { dg-do run } */ +/* There is a devirtualizable call. In PR60306 we deduced wrong target to cxa_pure_virtual. + For gcc 4.10 we temporarily disable the devirtualization. */ +/* { dg-options "-O3 -std=c++11" } */ + +#include + +using std::vector; + +class Object +{ +public: + + virtual Object* clone() const =0; + + virtual int type() const {return 0;} + + Object& operator=(const Object&) {return *this;} + + Object() {} + Object(const Object&) {} + virtual ~Object() {} +}; + +Object* f(const Object&o) +{ + return o.clone(); +} + +template +class Box: public Object, public T +{ +public: + Box* clone() const {return new Box(*this);} + + Box& operator=(const Box& t) + { + T::operator=(t); + return *this; + } + + Box& operator=(const T& t) + { + T::operator=(t); + return *this; + } + + Box() = default; + Box(const Box&) = default; + explicit Box(const T& t):T(t) {} +}; + +template +using Vector = Box>; + +typedef Vector OVector; + +OVector edges_connecting_to_node(int n) +{ + OVector branch_list_; + for(int i=0;i