From patchwork Tue Jan 27 17:00:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 433585 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 9C0AA140213 for ; Wed, 28 Jan 2015 04:32:40 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=Yv6aNb1++1P2258lpaC0cP1E3wQonGVoIhZ2lb4vZOBJyaquxAULg KmlhIydTDybUg8cZVEV4F74ehlNgEG0MXO2SRDbkMSyDIOlJ9MzlpCFElJYqoGoG kx3ITMZaAHvlHp890fBUxIa0BgZlYaVTgwNkHD0ytZpMqbixzBMccI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=EuL9khgTqpJh3mMncNq1vbzv1Gs=; b=YyBqyJM1Om59jVQUhjn8 YJ13/vq43feqAmzd5a7sTqCp4PR/+hsIDHDSC2CeJnJ7tq6tCzWVlTvx1nYrzKkl fXut9DiWXLyhxJ64Hl+3Yx+aIUjt6GMR/t971ZRZCpe9MAnFNcZGCXX5yyXZ6ztf gpsq6NMm+H30rFxVbhori44= Received: (qmail 19249 invoked by alias); 27 Jan 2015 17:00:42 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 19069 invoked by uid 89); 27 Jan 2015 17:00:33 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.1 required=5.0 tests=AWL, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 27 Jan 2015 17:00:27 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 6A86B541F97; Tue, 27 Jan 2015 18:00:23 +0100 (CET) Date: Tue, 27 Jan 2015 18:00:23 +0100 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: FIx gimple-fold ICE Message-ID: <20150127170023.GH19367@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Hi, this patch fixes ICE on type inconsistent programs where vtable pointer is worked out to be arbitrary pointer to something else. Bootstrapped/regtested x86_64-linux, comitted. Honza Index: ChangeLog =================================================================== --- ChangeLog (revision 220176) +++ ChangeLog (working copy) @@ -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. Index: testsuite/ChangeLog =================================================================== --- testsuite/ChangeLog (revision 220176) +++ testsuite/ChangeLog (working copy) @@ -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 Index: testsuite/g++.dg/torture/pr64282.C =================================================================== --- testsuite/g++.dg/torture/pr64282.C (revision 0) +++ testsuite/g++.dg/torture/pr64282.C (revision 0) @@ -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); +} Index: gimple-fold.c =================================================================== --- gimple-fold.c (revision 220142) +++ gimple-fold.c (working copy) @@ -5649,7 +5649,6 @@ gimple_get_virt_method_for_vtable (HOST_ 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;