This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for PR debug/29614


This patch fixes PR debug/29614 and causes no regressions on IA64 Linux.

I am not completely happy with this patch as it introduces a linear
search through varpool_assembled_nodes_queue.  But it should be noticed
that this code will only be used when not in unit-at-a-time mode (which
is also the only time the bug occurs).  I tried to see if I could fix it
by making sure that we always called varpool_output_debug_info after
each varpool_assemble_pending_decls call (when not in unit-at-a-time
mode) but that method did not work so I resorted to this method of
searching the list to make sure a declaration was not already on it.

I am not sure if having decls being put on varpool_nodes_queue multiple
times is a bug or not.  I don't think it is.  If it is, then that is the
underlying bug, if it is not then this may be an appropriate fix.

Ok to checkin?

Steve Ellcey
sje@cup.hp.com


:ADDPATCH debug:

2007-02-20  Steve Ellcey  <sje@cup.hp.com>

	PR debug/29614
	* varpool.c (varpool_assemble_pending_decls):  Do not put decls on
	varpool_assembled_nodes_queue more than once.

Index: varpool.c
===================================================================
--- varpool.c	(revision 122174)
+++ varpool.c	(working copy)
@@ -423,8 +423,23 @@ varpool_assemble_pending_decls (void)
       if (varpool_assemble_decl (node))
 	{
 	  changed = true;
-	  node->next_needed = varpool_assembled_nodes_queue;
-	  varpool_assembled_nodes_queue = node;
+	  if (varpool_assembled_nodes_queue)
+	    {
+	      /* Do not put a decl on the queue more than once.  */
+	      struct varpool_node *t = varpool_assembled_nodes_queue;
+	      while (t->next_needed != NULL && t->decl != node->decl)
+		t = t->next_needed;
+	      if (t->decl != node->decl)
+		{
+		  t->next_needed = node;
+		  node->next_needed = NULL;
+		}
+	    }
+	  else
+	    {
+	      varpool_assembled_nodes_queue = node;
+	      node->next_needed = NULL;
+	    }
 	  node->finalized = 1;
 	}
       else


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]