From patchwork Thu Oct 9 14:47:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Trippelsdorf X-Patchwork-Id: 398060 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 2333314003E for ; Fri, 10 Oct 2014 01:47:19 +1100 (EST) 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:cc:subject:message-id:mime-version:content-type; q=dns; s=default; b=budqRwAQoypbOpvNX63u08I96CAbPGlqy2lWX3G8/fPTz+1LsR xq1k2BV4ziY1MBt8FuTIQAYDHWU8JPdsLdhTdlBqLXh6NU/lSBQxq7ZlR3Dqfekv cmDmzJDqCtDmjMjL0OV49gZEK8RjWhtJ2b/SO0XVVDo8xVzuTywKne+E0= 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:cc:subject:message-id:mime-version:content-type; s= default; bh=LG3jNjA8YkMz+uXTgAkhvuQ0fk4=; b=WsbmpGuGQsHK5Bs/J72O kiFR7m+JcPoRlPDAYMHsxOqSU/HWYKtaupnkz0hJDk2p3iO6PHvebdPd7X3NDVQq iMQXlfq+6I2NmiQoQ6K6XMxCAsM3aBOsAqlrt/rN5DEWtQ1pnGptd86sm70qHfU7 Vx6rgADFiOw4JJ2C7av8G5E= Received: (qmail 17362 invoked by alias); 9 Oct 2014 14:47:13 -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 17351 invoked by uid 89); 9 Oct 2014 14:47:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL, BAYES_00, KAM_MXURI, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mail.ud10.udmedia.de Received: from ud10.udmedia.de (HELO mail.ud10.udmedia.de) (194.117.254.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 09 Oct 2014 14:47:10 +0000 Received: (qmail 13455 invoked from network); 9 Oct 2014 16:47:05 +0200 Received: from unknown (HELO x4) (ud10?360p3@91.64.94.144) by mail.ud10.udmedia.de with ESMTPSA (DHE-RSA-AES256-SHA encrypted, authenticated); 9 Oct 2014 16:47:05 +0200 Date: Thu, 9 Oct 2014 16:47:05 +0200 From: Markus Trippelsdorf To: gcc-patches@gcc.gnu.org Cc: Jan Hubicka Subject: [PATCH] Fix r216010 fallout Message-ID: <20141009144705.GA298@x4> MIME-Version: 1.0 Content-Disposition: inline This fixes fallout from r216010, which causes Firefox build failures. Just move the gcc_assert below the new if statement. Boostrapped and tested on powerpc64-unknown-linux-gnu. Ok for trunk? Thanks. 2014-10-09 Markus Trippelsdorf * pa-polymorphic-call.c (check_stmt_for_type_change): Move assertion. 2014-10-09 Markus Trippelsdorf * /g++.dg/ipa/polymorphic-call-1.C: New testcase. diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c index 51c6709a8655..7d58601ae365 100644 --- a/gcc/ipa-polymorphic-call.c +++ b/gcc/ipa-polymorphic-call.c @@ -1424,9 +1424,9 @@ check_stmt_for_type_change (ao_ref *ao ATTRIBUTE_UNUSED, tree vdef, void *data) } type = extr_type_from_vtbl_ptr_store (stmt, tci, &offset); - gcc_assert (!type || TYPE_MAIN_VARIANT (type) == type); if (type == error_mark_node) return false; + gcc_assert (!type || TYPE_MAIN_VARIANT (type) == type); if (!type) { if (dump_file) diff --git a/gcc/testsuite/g++.dg/ipa/polymorphic-call-1.C b/gcc/testsuite/g++.dg/ipa/polymorphic-call-1.C new file mode 100644 index 000000000000..2b5b54478349 --- /dev/null +++ b/gcc/testsuite/g++.dg/ipa/polymorphic-call-1.C @@ -0,0 +1,49 @@ +// { dg-do compile } +// { dg-options "-O2" } +class A; +class B +{ + A *mRawPtr; + +public: + void *StartAssignment___trans_tmp_2; + A ** + m_fn1 () + { + StartAssignment___trans_tmp_2 = &mRawPtr; + return reinterpret_cast (StartAssignment___trans_tmp_2); + } +}; +class C +{ +public: + C (B &p1) : mTargetSmartPtr (p1) {} + operator A **() { return mTargetSmartPtr.m_fn1 (); } + B &mTargetSmartPtr; +}; +class A +{ +public: + A (); +}; +class D +{ + D (bool); + B mNewEntry; + virtual int m_fn2 (); +}; +C +fn1 (B &p1) +{ + return p1; +} +void +fn2 (bool, A **) +{ + new A; +} +D::D (bool p1) +{ + A **a = fn1 (mNewEntry); + fn2 (p1, a); +}