[PATCH] Fix r216010 fallout

Jan Hubicka hubicka@ucw.cz
Thu Oct 9 17:46:00 GMT 2014


> 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?

OK, thanks!
Honza
> Thanks.
> 
> 2014-10-09  Markus Trippelsdorf  <markus@trippelsdorf.de>
> 
> 	* pa-polymorphic-call.c (check_stmt_for_type_change): Move
> 	assertion.
> 
> 2014-10-09  Markus Trippelsdorf  <markus@trippelsdorf.de>
> 
> 	* /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<A **> (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);
> +}
> -- 
> Markus



More information about the Gcc-patches mailing list