From: Markus Trippelsdorf Date: Thu, 9 Oct 2014 17:52:00 +0000 (+0000) Subject: Fix r216010 fallout X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=94c4084cf009939db425be4f6552b7f29f8587b3;p=gcc.git Fix r216010 fallout This fixes fallout from r216010, which causes Firefox build failures. Just move the gcc_assert below the new if statement. From-SVN: r216041 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 23d7bbe4f4c..280101caed5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-10-09 Markus Trippelsdorf + + * pa-polymorphic-call.c (check_stmt_for_type_change): Move + assertion. + 2014-10-09 Richard Biener PR tree-optimization/63380 diff --git a/gcc/ipa-polymorphic-call.c b/gcc/ipa-polymorphic-call.c index 51c6709a865..7d58601ae36 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/ChangeLog b/gcc/testsuite/ChangeLog index ceaf2b35d81..89d7f847909 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-10-09 Markus Trippelsdorf + + * g++.dg/ipa/polymorphic-call-1.C: New testcase. + 2014-10-09 Marc Glisse * g++.dg/cpp0x/constexpr-52892-1.C: Error on missing const in C++14. 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 00000000000..2b5b5447834 --- /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); +}