From b833dedd61dac54df19512744772c6765c6d33a4 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Tue, 27 Jan 2015 17:59:31 +0100 Subject: [PATCH] re PR ipa/64282 (ICE in gimple_get_virt_method_for_vtable, at gimple-fold.c:5635) PR ipa/64282 * gimple-fold.c (gimple_get_virt_method_for_vtable): Remove assert on vtable being vtable. * g++.dg/torture/pr64282.C: New testcase. From-SVN: r220177 --- gcc/ChangeLog | 6 ++ gcc/gimple-fold.c | 1 - gcc/testsuite/ChangeLog | 5 ++ gcc/testsuite/g++.dg/torture/pr64282.C | 101 +++++++++++++++++++++++++ 4 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/torture/pr64282.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3f7164d21cc..03097cf2a3f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-01-27 Jan Hubicka + + PR ipa/64282 + * gimple-fold.c (gimple_get_virt_method_for_vtable): Remove assert + on vtable being vtable. + 2015-01-27 Dominik Vogt * doc/extend.texi: s/390: Update documentation of hotpatch attribute. diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index baec077a533..3015901d8c1 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -5649,7 +5649,6 @@ gimple_get_virt_method_for_vtable (HOST_WIDE_INT token, if (TREE_CODE (v) != VAR_DECL || !DECL_VIRTUAL_P (v)) { - gcc_assert (in_lto_p); /* Pass down that we lost track of the target. */ if (can_refer) *can_refer = false; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1648a49b8fa..c8170c1525d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-01-27 Jan Hubicka + + PR ipa/64282 + * g++.dg/torture/pr64282.C: New testcase. + 2015-01-27 Kyrylo Tkachov * gcc.target/aarch64/store-pair-1.c: Update scan-assembler to check diff --git a/gcc/testsuite/g++.dg/torture/pr64282.C b/gcc/testsuite/g++.dg/torture/pr64282.C new file mode 100644 index 00000000000..48429884e9f --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr64282.C @@ -0,0 +1,101 @@ +// { dg-do compile } +template struct A +{ + _T1 first; +}; +struct B +{ + int operator!=(B); +}; +template struct C +{ + C (B); + _Tp operator*(); + int operator!=(C); +}; +template class D +{ +public: + typedef C<_Tp> const_iterator; + const_iterator m_fn1 () const; + B m_fn2 (); + void m_fn3 (); +}; +class F +{ + struct G + { + static G & + m_fn5 () + { + void fn1 (); + return *reinterpret_cast (fn1); + } + int * + m_fn6 () + { + return reinterpret_cast (this); + } + }; + struct _Alloc_hider + { + _Alloc_hider (int *p1, int) : _M_p (p1) {} + int *_M_p; + } _M_dataplus; + G & + m_fn4 () + { + return G::m_fn5 (); + } +public: + F () : _M_dataplus (m_fn4 ().m_fn6 (), 0) {} +}; +class H +{ + void m_fn7 (const F &, bool &); + bool m_fn8 (const D &, const F &, F &); +}; +typedef A CandPair; +class I +{ +public: + virtual void m_fn9 (const F &, bool, D &); +}; +class J : I +{ +public: + void m_fn9 (const F &, bool, D &); +}; +D c; +void +J::m_fn9 (const F &, bool, D &) +{ + D a; + for (B b; b != a.m_fn2 ();) + ; +} +inline void +fn2 (F p1, int, int, J *p4, D) +{ + D d; + d.m_fn3 (); + p4->m_fn9 (p1, 0, d); + for (D::const_iterator e = c.m_fn1 (); e != c.m_fn2 ();) + (*e)->m_fn9 (p1, 0, d); +} +void +H::m_fn7 (const F &, bool &) +{ + A f; + D g; + F h; + m_fn8 (g, f.first, h); +} +bool +H::m_fn8 (const D &p1, const F &, F &) +{ + F i; + p1.m_fn1 (); + D j; + fn2 (i, 0, 0, 0, j); +} -- 2.30.2