diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2014-03-02 21:51:48 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2014-03-02 20:51:48 +0000 |
commit | 993df21e9aacba1ff3236e0e0df0118573de8190 (patch) | |
tree | cc1f8936fe37b264e2fc78795755ba145c4cdc16 /gcc | |
parent | 9b0af790b789de605f6f7d818b375e50cf0c2904 (diff) | |
download | gcc-993df21e9aacba1ff3236e0e0df0118573de8190.zip gcc-993df21e9aacba1ff3236e0e0df0118573de8190.tar.gz gcc-993df21e9aacba1ff3236e0e0df0118573de8190.tar.bz2 |
re PR ipa/60306 (Incorrect devirtualization "pure virtual method called")
PR ipa/60306
Revert:
2013-12-14 Jan Hubicka <jh@suse.cz>
PR middle-end/58477
* ipa-prop.c (stmt_may_be_vtbl_ptr_store): Skip clobbers.
* testsuite/g++.dg/ipa/devirt-29.C: New testcase
From-SVN: r208261
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/ipa-prop.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/ipa/devirt-29.C | 75 |
4 files changed, 90 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4224c01..b6f1dac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2014-03-02 Jan Hubicka <hubicka@ucw.cz> + + PR ipa/60306 + + Revert: + 2013-12-14 Jan Hubicka <jh@suse.cz> + PR middle-end/58477 + * ipa-prop.c (stmt_may_be_vtbl_ptr_store): Skip clobbers. + 2014-03-02 Jon Beniston <jon@beniston.com> PR bootstrap/48230 diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 368b93b..4fb916a 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 b292df2..864057e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-03-02 Jan Hubicka <hubicka@ucw.cz> + + PR ipa/60306 + * testsuite/g++.dg/ipa/devirt-29.C: New testcase + 2014-03-02 Bernd Edlinger <bernd.edlinger@hotmail.de> 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 0000000..190d9e2 --- /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 <vector> + +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<typename T> +class Box: public Object, public T +{ +public: + Box<T>* clone() const {return new Box<T>(*this);} + + Box<T>& operator=(const Box<T>& t) + { + T::operator=(t); + return *this; + } + + Box<T>& operator=(const T& t) + { + T::operator=(t); + return *this; + } + + Box() = default; + Box(const Box<T>&) = default; + explicit Box(const T& t):T(t) {} +}; + +template <typename T> +using Vector = Box<vector<T>>; + +typedef Vector<int> OVector; + +OVector edges_connecting_to_node(int n) +{ + OVector branch_list_; + for(int i=0;i<n;i++) + branch_list_.push_back(i); + + return branch_list_; +} + +int main(int argc,char* argv[]) +{ + for(int n=0; n < argc; n++) + { + auto x = edges_connecting_to_node(1); + x.clone(); + f(x); + } +} |