Patchwork [pph] Fix remaining cgraph ICEs (issue5325050)

login
register
mail settings
Submitter Diego Novillo
Date Oct. 29, 2011, 6:23 p.m.
Message ID <20111029182323.6529F1DA196@topo.tor.corp.google.com>
Download mbox | patch
Permalink /patch/122548/
State New
Headers show

Comments

Diego Novillo - Oct. 29, 2011, 6:23 p.m.
When emitting the symbols and cgraph nodes in the symbol table, we were
using the same pointer set to decide whether to emit decls and cgraph
nodes.

So, if a function decl F was sent to rest_of_decl_compilation, we would
later refuse to call cgraph_finalize_function on its node because F had
already been emitted.

Fixed by separating the already-emitted test for decls and cgraph nodes.

Tested on x86_64.  Committed.


Diego.

cp/ChangeLog.pph

	* pph-streamer-in.c (pph_node_already_emitted): New.
	(pph_in_symtab): Call it.

testsuite/ChangeLog.pph

	* g++.dg/pph/x1keyed.cc: Mark fixed.
	* g++.dg/pph/x1keyno.cc: Likewise.
	* g++.dg/pph/x6rtti.cc: Remove ICE failure.  Document operator match
	problem.
	* g++.dg/pph/x7rtti.cc: Likewise.
	* g++.dg/pph/x1tmplclass2.cc: Document asm diff to out-of-order diff.
	* g++.dg/pph/z4tmplclass2.cc: Likewise.
	* g++.dg/pph/x4keyex.cc: Likewise.
	* g++.dg/pph/x4keyed.cc: Change failure to typeinfo redefinition.
	* g++.dg/pph/x4keyno.cc: Likewise.
---
 gcc/cp/ChangeLog.pph                     |    5 +++++
 gcc/cp/pph-streamer-in.c                 |   17 ++++++++++++++++-
 gcc/testsuite/ChangeLog.pph              |   13 +++++++++++++
 gcc/testsuite/g++.dg/pph/x1keyed.cc      |    3 ---
 gcc/testsuite/g++.dg/pph/x1keyno.cc      |    3 ---
 gcc/testsuite/g++.dg/pph/x1tmplclass2.cc |    9 ++-------
 gcc/testsuite/g++.dg/pph/x4keyed.cc      |    5 ++---
 gcc/testsuite/g++.dg/pph/x4keyex.cc      |    6 +-----
 gcc/testsuite/g++.dg/pph/x4keyno.cc      |    8 ++------
 gcc/testsuite/g++.dg/pph/x6rtti.cc       |   10 +++-------
 gcc/testsuite/g++.dg/pph/x7rtti.cc       |    5 ++---
 gcc/testsuite/g++.dg/pph/z4tmplclass2.cc |    2 +-
 12 files changed, 47 insertions(+), 39 deletions(-)

Patch

diff --git a/gcc/cp/ChangeLog.pph b/gcc/cp/ChangeLog.pph
index 0dd8e20..5c64739 100644
--- a/gcc/cp/ChangeLog.pph
+++ b/gcc/cp/ChangeLog.pph
@@ -1,3 +1,8 @@ 
+2011-10-29   Diego Novillo  <dnovillo@google.com>
+
+	* pph-streamer-in.c (pph_node_already_emitted): New.
+	(pph_in_symtab): Call it.
+
 2011-10-28   Lawrence Crowl  <crowl@google.com>
 
 	* pph.c (pph_dump_tree_name): Remove dead code.  Dump tree_code also.
diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
index 40f82c3..40d3fc2 100644
--- a/gcc/cp/pph-streamer-in.c
+++ b/gcc/cp/pph-streamer-in.c
@@ -2209,6 +2209,19 @@  pph_decl_already_emitted (tree decl)
 }
 
 
+/* Have we already emitted this cgraph NODE?  */
+
+static bool
+pph_node_already_emitted (struct cgraph_node *node)
+{
+  static struct pointer_set_t *emitted_nodes = NULL;
+  gcc_assert (node != NULL);
+  if (!emitted_nodes)
+    emitted_nodes = pointer_set_create ();
+  return pointer_set_insert (emitted_nodes, node) != 0;
+}
+
+
 /* Read the symbol table from STREAM.  When this image is read into
    another translation unit, we want to guarantee that the IL
    instances taken from this image are instantiated in the same order
@@ -2241,6 +2254,7 @@  pph_in_symtab (pph_stream *stream)
 	  at_end = bp_unpack_value (&bp, 1);
           if (pph_decl_already_emitted (decl))
             continue;
+
 	  cp_rest_of_decl_compilation (decl, top_level, at_end);
 	}
       else if (action == PPH_SYMTAB_EXPAND)
@@ -2251,8 +2265,9 @@  pph_in_symtab (pph_stream *stream)
 	  node = pph_in_cgraph_node (stream);
 	  if (node && node->local.finalized)
 	    {
-	      if (pph_decl_already_emitted (decl))
+	      if (pph_node_already_emitted (node))
 		continue;
+
 	      /* Since the writer had finalized this cgraph node,
 		 we have to re-play its actions.  To do that, we need
 		 to clear the finalized and reachable bits in the
diff --git a/gcc/testsuite/ChangeLog.pph b/gcc/testsuite/ChangeLog.pph
index b8d2e27..8994e63 100644
--- a/gcc/testsuite/ChangeLog.pph
+++ b/gcc/testsuite/ChangeLog.pph
@@ -1,3 +1,16 @@ 
+2011-10-29   Diego Novillo  <dnovillo@google.com>
+
+	* g++.dg/pph/x1keyed.cc: Mark fixed.
+	* g++.dg/pph/x1keyno.cc: Likewise.
+	* g++.dg/pph/x6rtti.cc: Remove ICE failure.  Document operator match
+	problem.
+	* g++.dg/pph/x7rtti.cc: Likewise.
+	* g++.dg/pph/x1tmplclass2.cc: Document asm diff to out-of-order diff.
+	* g++.dg/pph/z4tmplclass2.cc: Likewise.
+	* g++.dg/pph/x4keyex.cc: Likewise.
+	* g++.dg/pph/x4keyed.cc: Change failure to typeinfo redefinition.
+	* g++.dg/pph/x4keyno.cc: Likewise.
+
 2011-10-26   Diego Novillo  <dnovillo@google.com>
 
 	* g++.dg/pph/c4inline.cc: Mark fixed.
diff --git a/gcc/testsuite/g++.dg/pph/x1keyed.cc b/gcc/testsuite/g++.dg/pph/x1keyed.cc
index 18eb4c8..6ef9b9a 100644
--- a/gcc/testsuite/g++.dg/pph/x1keyed.cc
+++ b/gcc/testsuite/g++.dg/pph/x1keyed.cc
@@ -1,6 +1,3 @@ 
-// { dg-xfail-if "ICE CGRAPH" { "*-*-*" } { "-fpph-map=pph.map" } }
-// { dg-bogus "x1keyed.cc:12:1: internal compiler error: in cgraph_analyze_functions, at cgraphunit.c:1193" "" { xfail *-*-* } 0 }
-
 #include "x0keyed1.h"
 
 int keyed::key( int arg ) { return mix( field & arg ); }
diff --git a/gcc/testsuite/g++.dg/pph/x1keyno.cc b/gcc/testsuite/g++.dg/pph/x1keyno.cc
index 50517d2..a0d985c 100644
--- a/gcc/testsuite/g++.dg/pph/x1keyno.cc
+++ b/gcc/testsuite/g++.dg/pph/x1keyno.cc
@@ -1,6 +1,3 @@ 
-// { dg-xfail-if "ICE CGRAPH" { "*-*-*" } { "-fpph-map=pph.map" } }
-// { dg-bogus "x1keyno.cc:10:1: internal compiler error: in cgraph_analyze_functions, at cgraphunit.c:1193" "" { xfail *-*-* } 0 }
-
 #include "x0keyno1.h"
 
 int main()
diff --git a/gcc/testsuite/g++.dg/pph/x1tmplclass2.cc b/gcc/testsuite/g++.dg/pph/x1tmplclass2.cc
index ca84924..6d268af 100644
--- a/gcc/testsuite/g++.dg/pph/x1tmplclass2.cc
+++ b/gcc/testsuite/g++.dg/pph/x1tmplclass2.cc
@@ -1,9 +1,4 @@ 
-// pph asm xdiff 34237
-// xfail BOGUS MISSVAR, MISSFUNC
-// The assembly is missing a template class static member variable
-// base<char>::variable instantiated in a prior pph file.
-// Functions base<double>::d_static_non_inline() and
-// base<double>::d_dynamic_non_inline() are also missing.
-
+// pph asm xdiff 37711
+// Soft failure.  Symbols are emitted in different order in pph compile.
 #include "x0tmplclass23.h"
 #include "a0tmplclass2_u.h"
diff --git a/gcc/testsuite/g++.dg/pph/x4keyed.cc b/gcc/testsuite/g++.dg/pph/x4keyed.cc
index 2eaeb63..62c1d00 100644
--- a/gcc/testsuite/g++.dg/pph/x4keyed.cc
+++ b/gcc/testsuite/g++.dg/pph/x4keyed.cc
@@ -1,6 +1,5 @@ 
-// { dg-xfail-if "ICE CGRAPH" { "*-*-*" } { "-fpph-map=pph.map" } }
-// { dg-bogus "x4keyed.cc:14:1: internal compiler error: in cgraph_analyze_functions, at cgraphunit.c:1193" "" { xfail *-*-* } 0 }
-// { dg-excess-errors "callgraph problems" }
+// { dg-xfail-if "redefinition problems" { *-*-* } { "-fpph-map=pph.map" } }
+// { dg-excess-errors "typeinfo redefinition problems.  May be merging issue for global binding" }
 
 #include "x0keyed1.h"
 #include "x0keyed2.h"
diff --git a/gcc/testsuite/g++.dg/pph/x4keyex.cc b/gcc/testsuite/g++.dg/pph/x4keyex.cc
index 9482e01..ddf4328 100644
--- a/gcc/testsuite/g++.dg/pph/x4keyex.cc
+++ b/gcc/testsuite/g++.dg/pph/x4keyex.cc
@@ -1,8 +1,4 @@ 
-// { dg-xfail-if "ICE CGRAPH" { "*-*-*" } { "-fpph-map=pph.map" } }
-// { dg-bogus "x4keyex.cc:29:1: internal compiler error: in cgraph_analyze_functions, at cgraphunit.c:1193" "" { xfail *-*-* } 0 }
-
-// Previously.
-// xfail BOGUS MERGE LABELS
+// pph asm xdiff 32642
 //
 // This test case fails to compare because LFB/LFE labels are different.
 //
diff --git a/gcc/testsuite/g++.dg/pph/x4keyno.cc b/gcc/testsuite/g++.dg/pph/x4keyno.cc
index 8bc7b5a..2e2ed1d 100644
--- a/gcc/testsuite/g++.dg/pph/x4keyno.cc
+++ b/gcc/testsuite/g++.dg/pph/x4keyno.cc
@@ -1,9 +1,5 @@ 
-// { dg-xfail-if "ICE CGRAPH" { "*-*-*" } { "-fpph-map=pph.map" } }
-// { dg-bogus "x4keyno.cc:15:1: internal compiler error: in cgraph_analyze_functions, at cgraphunit.c:1193" "" { xfail *-*-* } 0 }
-// { dg-excess-errors "typeinfo name duplicatd" }
-
-// Previously.
-// The variable for the typeinfo name for 'keyno' is duplicated.
+// { dg-xfail-if "redefinition problems" { *-*-* } { "-fpph-map=pph.map" } }
+// { dg-excess-errors "The variable for the typeinfo name for 'keyno' is duplicated." }
 
 #include "x0keyno1.h"
 #include "x0keyno2.h"
diff --git a/gcc/testsuite/g++.dg/pph/x6rtti.cc b/gcc/testsuite/g++.dg/pph/x6rtti.cc
index 55eb7ee..3fd81bc 100644
--- a/gcc/testsuite/g++.dg/pph/x6rtti.cc
+++ b/gcc/testsuite/g++.dg/pph/x6rtti.cc
@@ -1,10 +1,6 @@ 
-// { dg-xfail-if "ICE CGRAPH" { "*-*-*" } { "-fpph-map=pph.map" } }
-// { dg-bogus "x6rtti.cc:14:1: internal compiler error: in cgraph_analyze_functions, at cgraphunit.c:1193" "" { xfail *-*-* } 0 }
-// { dg-excess-errors "callgraph problems" }
-
-// Previously:
-// "BOGUS POSSIBLE TYPE MISMERGE"
-//FIXME We should make this a run test.
+// { dg-xfail-if "rtti problems" { *-*-* } { "-fpph-map=pph.map" } }
+// { dg-excess-errors "operator match problems due to type merging." }
+// FIXME pph - We should make this a run test.
 
 #include "x5rtti1.h"
 
diff --git a/gcc/testsuite/g++.dg/pph/x7rtti.cc b/gcc/testsuite/g++.dg/pph/x7rtti.cc
index 84c3b77..9d1704a 100644
--- a/gcc/testsuite/g++.dg/pph/x7rtti.cc
+++ b/gcc/testsuite/g++.dg/pph/x7rtti.cc
@@ -1,8 +1,7 @@ 
-// FIXME pph: This should be a { dg=do run } (with '=' replaced by '-')
-// { dg-xfail-if "ICE CGRAPH" { "*-*-*" } { "-fpph-map=pph.map" } }
-// { dg-bogus "x7rtti.cc:22:1: internal compiler error: in cgraph_analyze_functions, at cgraphunit.c:1193" "" { xfail *-*-* } 0 }
+// { dg-xfail-if "rtti problems" { *-*-* } { "-fpph-map=pph.map" } }
 // { dg-excess-errors "macro redefinition and operator match problems" }
 
+// FIXME pph: This should be a { dg=do run } (with '=' replaced by '-')
 #include "x5rtti1.h"
 #include "x5rtti2.h"
 
diff --git a/gcc/testsuite/g++.dg/pph/z4tmplclass2.cc b/gcc/testsuite/g++.dg/pph/z4tmplclass2.cc
index 4d2bac9..624bb3f 100644
--- a/gcc/testsuite/g++.dg/pph/z4tmplclass2.cc
+++ b/gcc/testsuite/g++.dg/pph/z4tmplclass2.cc
@@ -1,4 +1,4 @@ 
-// pph asm xdiff 16961
+// pph asm xdiff 41000
 // xfail BOGUS DUPVAR DUPFUNC
 
 #include "x0tmplclass23.h"