From 21833f2df07ba269b517e98946605b5a8385625c Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Wed, 10 Sep 2014 08:33:36 +0200 Subject: [PATCH] re PR lto/63166 (ICE (LTO): ipa_intraprocedural_devirtualization, at ipa-prop.c:2611) PR ipa/63166 * ipa-prop.c (compute_known_type_jump_func): Fix conditional. * g++.dg/lto/pr63166_0.ii: New testcase. * g++.dg/lto/pr63166_1.ii: New testcase. From-SVN: r215105 --- gcc/ChangeLog | 5 ++ gcc/ipa-prop.c | 4 +- gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/g++.dg/lto/pr63166_0.ii | 37 +++++++++ gcc/testsuite/g++.dg/lto/pr63166_1.ii | 108 ++++++++++++++++++++++++++ 5 files changed, 157 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/lto/pr63166_0.ii create mode 100644 gcc/testsuite/g++.dg/lto/pr63166_1.ii diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9357a6f9748..71d0700678a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-09-10 Jan Hubicka + + PR ipa/63166 + * ipa-prop.c (compute_known_type_jump_func): Fix conditional. + 2014-09-10 Alexander Ivchenko Maxim Kuznetsov Anna Tikhonova diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c index 9632ea85b67..bbb417dead5 100644 --- a/gcc/ipa-prop.c +++ b/gcc/ipa-prop.c @@ -1537,8 +1537,8 @@ compute_known_type_jump_func (tree op, struct ipa_jump_func *jfunc, call, current_function_decl) /* Even if the var seems to be in construction by inline call stack, we may work out the actual type by walking memory writes. */ - && (!is_global_var (base) - && detect_type_change (op, base, expected_type, call, jfunc, offset))) + && (is_global_var (base) + || detect_type_change (op, base, expected_type, call, jfunc, offset))) return; ipa_set_jf_known_type (jfunc, offset, TREE_TYPE (base), diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0a2562ab42c..e18eea341e3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-09-10 Jan Hubicka + + * g++.dg/lto/pr63166_0.ii: New testcase. + * g++.dg/lto/pr63166_1.ii: New testcase. + 2014-09-09 Manuel López-Ibáñez * gcc.dg/cpp/warn-normalized-3.c: Delete useless dg-prune-output. diff --git a/gcc/testsuite/g++.dg/lto/pr63166_0.ii b/gcc/testsuite/g++.dg/lto/pr63166_0.ii new file mode 100644 index 00000000000..f8ef7120861 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr63166_0.ii @@ -0,0 +1,37 @@ +// { dg-lto-do compile } +extern "C" +{ + extern long unsigned int strlen (__const char *__s); +} +class Cstring +{ +}; +class Foobar_Out +{ + virtual void put_to_buf (const char *str, long unsigned int msg_len); + void put_to_buf (const char *str) + { + put_to_buf (str, strlen (str)); + } + Foobar_Out & operator << (const char *str); + Foobar_Out & operator << (const Cstring & cstring); +}; + +class Foobar_Log:public Foobar_Out +{ + Foobar_Log (int channel); + virtual void put_to_buf (const char *str, long unsigned int msg_len); +}; +Foobar_Out & Foobar_Out::operator << (const char *str) +{ + put_to_buf (str); +} + +Foobar_Out & Foobar_Out::operator << (const Cstring & cstring) +{ + return *this; +} + +Foobar_Log::Foobar_Log (int ch) +{ +} diff --git a/gcc/testsuite/g++.dg/lto/pr63166_1.ii b/gcc/testsuite/g++.dg/lto/pr63166_1.ii new file mode 100644 index 00000000000..29438fe5edc --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr63166_1.ii @@ -0,0 +1,108 @@ +class EIdent { }; +class Cstring { }; +template < class KEY, class VALUE, class HASHER > class HashMapIterator +{ +public: + virtual ~ HashMapIterator () { } +}; + +class ECell; +class ECell_ptr +{ + ECell *mp_element; +public: + ECell * operator -> () const + { + return (mp_element); + } +} +sicat_cmd_status; +class CellListIterator; +class ECellList +{ +public: + virtual CellListIterator * createIterator () const = 0; + virtual ECell_ptr Find (const EIdent & anIdent) = 0; +}; +class Foobar_Out +{ + virtual int get_channel () { } +public: + Foobar_Out & operator << (const char *str); + Foobar_Out & operator << (const Cstring & cstring); +}; + +class Foobar_Log:public Foobar_Out { }; +extern Foobar_Log Foobar_LOG; +template < class KEY > class BagIterator +{ +public: + inline const KEY & operator * () const; + inline int atEnd () const; +}; + +class EMaskView; +class ECell +{ +public: + virtual const EMaskView & getMaskView () const = 0; +}; +class FoobarDatabase +{ +public: + const Cstring & getName (const EIdent & id) const; + ECellList *getCellList (); +}; +inline FoobarDatabase & +DB () { } + +class EMaskView +{ +public: + inline BagIterator < EIdent > getCallerIterator () const; +}; +struct DBHashFunctions +{ +}; +class CellListIterator:public HashMapIterator < EIdent, ECell *, + DBHashFunctions > +{ +}; +class IdentSet +{ +public: + unsigned int getSize () const { } + int isEmpty () const { } +}; +class IdentSetIterator +{ +public: + IdentSetIterator (const IdentSet * p_source) { } + int atEnd () const { } + EIdent operator* () const { } +}; +void +validate () +{ + IdentSet complete_cell_ids; + IdentSet incomplete_cell_ids; + CellListIterator *p_cl_it = DB ().getCellList ()->createIterator (); + delete p_cl_it; + while (!incomplete_cell_ids.isEmpty ()) + { + if (incomplete_cell_ids.getSize () < complete_cell_ids.getSize ()) + { + IdentSetIterator complete_cell_it (&complete_cell_ids); + while (!complete_cell_it.atEnd ()) + { + BagIterator < EIdent > caller_it = + DB ().getCellList ()->Find (*complete_cell_it)-> + getMaskView ().getCallerIterator (); + while (!caller_it.atEnd ()) + { + Foobar_LOG << DB ().getName (*caller_it) << " "; + } + } + } + } +} -- 2.30.2