Fix pr83619.C (was Re: Fix ICE with profile info mismatch)

Message ID 20180118225752.GL2063@tucnak
State New
Headers show
Series
  • Fix pr83619.C (was Re: Fix ICE with profile info mismatch)
Related show

Commit Message

Jakub Jelinek Jan. 18, 2018, 10:57 p.m.
On Thu, Jan 18, 2018 at 04:59:01PM +0100, Jan Hubicka wrote:
> this patch ICE where the profile in cgraph mismatch profile in BB. This is becuase

> of expansion of speculative devirtualization where we get some roundoff issues.

> 

> Bootstrapped/regtested x86_64-linux, comitted.

> Honza

> 

> 	PR ipa/83619

> 	* g++.dg/torture/pr83619.C: New testcase.

> 	* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Update edge

> 	frequencies.

> --- testsuite/g++.dg/torture/pr83619.C	(revision 0)

> +++ testsuite/g++.dg/torture/pr83619.C	(working copy)

...

This testcase FAILs everywhere:
/.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C: In static member function 'static void i::j< <template-parameter-1-1> >::c(e*)':
/.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C:25:8: warning: invalid use of incomplete type 'class e'
/.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C:8:7: note: forward declaration of 'class e'
FAIL: g++.dg/torture/pr83619.C   -O0  (test for excess errors)
Excess errors:
/.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C:25:8: warning: invalid use of incomplete type 'class e'

The following patch tweaks it so that it doesn't emit the warning, yet still
ICEs before your cgraph.c change and PASSes after it.
Tested on x86_64-linux and i686-linux, ok for trunk?

2018-01-18  Jakub Jelinek  <jakub@redhat.com>

	PR ipa/83619
	* g++.dg/torture/pr83619.C (e): Define before first use instead of
	forward declaration.


	Jakub

Comments

Jeff Law Jan. 18, 2018, 11:35 p.m. | #1
On 01/18/2018 03:57 PM, Jakub Jelinek wrote:
> On Thu, Jan 18, 2018 at 04:59:01PM +0100, Jan Hubicka wrote:

>> this patch ICE where the profile in cgraph mismatch profile in BB. This is becuase

>> of expansion of speculative devirtualization where we get some roundoff issues.

>>

>> Bootstrapped/regtested x86_64-linux, comitted.

>> Honza

>>

>> 	PR ipa/83619

>> 	* g++.dg/torture/pr83619.C: New testcase.

>> 	* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Update edge

>> 	frequencies.

>> --- testsuite/g++.dg/torture/pr83619.C	(revision 0)

>> +++ testsuite/g++.dg/torture/pr83619.C	(working copy)

> ...

> 

> This testcase FAILs everywhere:

> /.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C: In static member function 'static void i::j< <template-parameter-1-1> >::c(e*)':

> /.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C:25:8: warning: invalid use of incomplete type 'class e'

> /.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C:8:7: note: forward declaration of 'class e'

> FAIL: g++.dg/torture/pr83619.C   -O0  (test for excess errors)

> Excess errors:

> /.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C:25:8: warning: invalid use of incomplete type 'class e'

> 

> The following patch tweaks it so that it doesn't emit the warning, yet still

> ICEs before your cgraph.c change and PASSes after it.

> Tested on x86_64-linux and i686-linux, ok for trunk?

> 

> 2018-01-18  Jakub Jelinek  <jakub@redhat.com>

> 

> 	PR ipa/83619

> 	* g++.dg/torture/pr83619.C (e): Define before first use instead of

> 	forward declaration.

OK.

Note I think someone has filed a regression against this failure.  SO
you might want to check the recent P3s to find and close it out.

jeff
Jan Hubicka Jan. 19, 2018, 9:09 a.m. | #2
> On Thu, Jan 18, 2018 at 04:59:01PM +0100, Jan Hubicka wrote:

> > this patch ICE where the profile in cgraph mismatch profile in BB. This is becuase

> > of expansion of speculative devirtualization where we get some roundoff issues.

> > 

> > Bootstrapped/regtested x86_64-linux, comitted.

> > Honza

> > 

> > 	PR ipa/83619

> > 	* g++.dg/torture/pr83619.C: New testcase.

> > 	* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Update edge

> > 	frequencies.

> > --- testsuite/g++.dg/torture/pr83619.C	(revision 0)

> > +++ testsuite/g++.dg/torture/pr83619.C	(working copy)

> ...

> 

> This testcase FAILs everywhere:

> /.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C: In static member function 'static void i::j< <template-parameter-1-1> >::c(e*)':

> /.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C:25:8: warning: invalid use of incomplete type 'class e'

> /.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C:8:7: note: forward declaration of 'class e'

> FAIL: g++.dg/torture/pr83619.C   -O0  (test for excess errors)

> Excess errors:

> /.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C:25:8: warning: invalid use of incomplete type 'class e'

> 

> The following patch tweaks it so that it doesn't emit the warning, yet still

> ICEs before your cgraph.c change and PASSes after it.

> Tested on x86_64-linux and i686-linux, ok for trunk?

> 

> 2018-01-18  Jakub Jelinek  <jakub@redhat.com>

> 

> 	PR ipa/83619

> 	* g++.dg/torture/pr83619.C (e): Define before first use instead of

> 	forward declaration.


Oops, sorry. I had corrected version somewhere. The change is OK.

Honz
> 

> --- gcc/testsuite/g++.dg/torture/pr83619.C.jj	2018-01-18 21:11:54.865206861 +0100

> +++ gcc/testsuite/g++.dg/torture/pr83619.C	2018-01-18 23:51:32.693482293 +0100

> @@ -5,7 +5,9 @@ class d

>  public:

>    virtual unsigned c ();

>  };

> -class e;

> +class e : public d

> +{

> +};

>  class i

>  {

>    void h ();

> @@ -33,9 +35,6 @@ public:

>    l (int);

>    k *operator-> ();

>  };

> -class e : public d

> -{

> -};

>  class m final : e

>  {

>    unsigned c ();

> 

> 	Jakub
Rainer Orth Jan. 19, 2018, 1:33 p.m. | #3
Hi Jan,

>> On Thu, Jan 18, 2018 at 04:59:01PM +0100, Jan Hubicka wrote:

>> > this patch ICE where the profile in cgraph mismatch profile in BB. This

>> > is becuase

>> > of expansion of speculative devirtualization where we get some roundoff

>> > issues.

>> > 

>> > Bootstrapped/regtested x86_64-linux, comitted.

>> > Honza

>> > 

>> > 	PR ipa/83619

>> > 	* g++.dg/torture/pr83619.C: New testcase.

>> > 	* cgraph.c (cgraph_edge::redirect_call_stmt_to_callee): Update edge

>> > 	frequencies.

>> > --- testsuite/g++.dg/torture/pr83619.C	(revision 0)

>> > +++ testsuite/g++.dg/torture/pr83619.C	(working copy)

>> ...

>> 

>> This testcase FAILs everywhere:

>> /.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C: In static member

>> function 'static void i::j< <template-parameter-1-1> >::c(e*)':

>> /.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C:25:8: warning: invalid

>> use of incomplete type 'class e'

>> /.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C:8:7: note: forward

>> declaration of 'class e'

>> FAIL: g++.dg/torture/pr83619.C   -O0  (test for excess errors)

>> Excess errors:

>> /.../gcc/gcc/testsuite/g++.dg/torture/pr83619.C:25:8: warning: invalid

>> use of incomplete type 'class e'

>> 

>> The following patch tweaks it so that it doesn't emit the warning, yet still

>> ICEs before your cgraph.c change and PASSes after it.

>> Tested on x86_64-linux and i686-linux, ok for trunk?

>> 

>> 2018-01-18  Jakub Jelinek  <jakub@redhat.com>

>> 

>> 	PR ipa/83619

>> 	* g++.dg/torture/pr83619.C (e): Define before first use instead of

>> 	forward declaration.

>

> Oops, sorry. I had corrected version somewhere. The change is OK.


however, the test now FAILs everywhere with

+FAIL: g++.dg/torture/pr83619.C   -O0  (test for excess errors)
+FAIL: g++.dg/torture/pr83619.C   -O1  (test for excess errors)
+FAIL: g++.dg/torture/pr83619.C   -O2  (test for excess errors)
+FAIL: g++.dg/torture/pr83619.C   -O2 -flto  (test for excess errors)
+FAIL: g++.dg/torture/pr83619.C   -O2 -flto -flto-partition=none  (test for excess errors)
+FAIL: g++.dg/torture/pr83619.C   -O3 -g  (test for excess errors)
+FAIL: g++.dg/torture/pr83619.C   -Os  (test for excess errors)

from

      g->c ();                 // { dg-message "incomplete" }

Removing the dg-message cures this.  Tested with the appropriate runtest
invocation on i386-pc-solaris2.11.

Ok for mainline?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2018-01-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	* g++.dg/torture/pr83619.C: Remove dg-message.
diff --git a/gcc/testsuite/g++.dg/torture/pr83619.C b/gcc/testsuite/g++.dg/torture/pr83619.C
--- a/gcc/testsuite/g++.dg/torture/pr83619.C
+++ b/gcc/testsuite/g++.dg/torture/pr83619.C
@@ -24,7 +24,7 @@ public:
     static void
     c (e *g)
     {
-      g->c ();			// { dg-message "incomplete" }
+      g->c ();
     }
   };
 };
Jakub Jelinek Jan. 19, 2018, 1:52 p.m. | #4
On Fri, Jan 19, 2018 at 02:33:09PM +0100, Rainer Orth wrote:
> however, the test now FAILs everywhere with

> 

> +FAIL: g++.dg/torture/pr83619.C   -O0  (test for excess errors)

> +FAIL: g++.dg/torture/pr83619.C   -O1  (test for excess errors)

> +FAIL: g++.dg/torture/pr83619.C   -O2  (test for excess errors)

> +FAIL: g++.dg/torture/pr83619.C   -O2 -flto  (test for excess errors)

> +FAIL: g++.dg/torture/pr83619.C   -O2 -flto -flto-partition=none  (test for excess errors)

> +FAIL: g++.dg/torture/pr83619.C   -O3 -g  (test for excess errors)

> +FAIL: g++.dg/torture/pr83619.C   -Os  (test for excess errors)

> 

> from

> 

>       g->c ();                 // { dg-message "incomplete" }

> 

> Removing the dg-message cures this.  Tested with the appropriate runtest

> invocation on i386-pc-solaris2.11.


Oops, no idea how I've missed it.

> 2018-01-19  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

> 

> 	* g++.dg/torture/pr83619.C: Remove dg-message.


Ok, thanks.

> diff --git a/gcc/testsuite/g++.dg/torture/pr83619.C b/gcc/testsuite/g++.dg/torture/pr83619.C

> --- a/gcc/testsuite/g++.dg/torture/pr83619.C

> +++ b/gcc/testsuite/g++.dg/torture/pr83619.C

> @@ -24,7 +24,7 @@ public:

>      static void

>      c (e *g)

>      {

> -      g->c ();			// { dg-message "incomplete" }

> +      g->c ();

>      }

>    };

>  };



	Jakub

Patch

--- gcc/testsuite/g++.dg/torture/pr83619.C.jj	2018-01-18 21:11:54.865206861 +0100
+++ gcc/testsuite/g++.dg/torture/pr83619.C	2018-01-18 23:51:32.693482293 +0100
@@ -5,7 +5,9 @@  class d
 public:
   virtual unsigned c ();
 };
-class e;
+class e : public d
+{
+};
 class i
 {
   void h ();
@@ -33,9 +35,6 @@  public:
   l (int);
   k *operator-> ();
 };
-class e : public d
-{
-};
 class m final : e
 {
   unsigned c ();