Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2381)

Issue 5822054: [pph] Identify and diagnose one class of bad merges (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 1 month ago by Diego Novillo
Modified:
12 years, 1 month ago
Reviewers:
CC:
Lawrence Crowl, gcc-patches_gcc.gnu.org
Visibility:
Public.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+17 lines, -1 line) Patch
M gcc/cp/pph-in.c View 1 chunk +17 lines, -1 line 0 comments Download

Messages

Total messages: 1
Diego Novillo
12 years, 1 month ago (2012-03-14 23:49:36 UTC) #1
Detect one class of invalid merges.

When merging two different EXPRs, we are currently merging some trees
that should not be merged.  This patch tries to identify one case
where we can certainly detect that a bad merge is about to happen.

This fixes no tests, but diagnoses quite a few bad merges in our
internal testing.  Lawrence will be producing test cases for those.

2012-03-14   Diego Novillo  <dnovillo@google.com>

	* pph-in.c (pph_in_merge_key_tree_with_searcher): Detect and
	diagnose attempts to merge two distinct trees from the same
	PPH image.

diff --git a/gcc/cp/pph-in.c b/gcc/cp/pph-in.c
index a328e13..ba89aa4 100644
--- a/gcc/cp/pph-in.c
+++ b/gcc/cp/pph-in.c
@@ -2625,7 +2625,23 @@ pph_in_merge_key_tree_with_searcher (pph_stream *stream,
void *holder,
   gcc_assert (expr != NULL);
 
   if (expr != read_expr)
-    pph_merge_tree_attributes (expr, read_expr);
+    {
+      /* When STREAM was generated, EXPR and READ_EXPR were saved as
+	 distinct trees (otherwise, we would have gotten READ_EXPR as
+	 an internal reference). That's why we are reading them now as
+	 distinct pointers.
+
+	 So, if we find that EXPR has already been registered in
+	 STREAM's cache, it means that we should not be trying to
+	 merge them.  After all, the writer considered them different
+	 objects.  */
+      if (pph_cache_lookup (&stream->cache, expr, NULL,
+			    pph_tree_code_to_tag (expr)))
+	fatal_error ("Trying to merge distinct trees from the same "
+		     "PPH image %s", stream->name);
+
+      pph_merge_tree_attributes (expr, read_expr);
+    }
 
   pph_cache_insert_at (&stream->cache, expr, ix,
 		       pph_tree_code_to_tag (expr));

--
This patch is available for review at http://codereview.appspot.com/5822054
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b