Patchwork [pph] Put tinst_level list in forward order (issue4823059)

login
register
mail settings
Submitter Lawrence Crowl
Date July 28, 2011, 11:18 p.m.
Message ID <20110728231816.EA2E42225F1@jade.mtv.corp.google.com>
Download mbox | patch
Permalink /patch/107314/
State New
Headers show

Comments

Lawrence Crowl - July 28, 2011, 11:18 p.m.
Place the tinst_level list in forward order.

Tested on x64.



--
This patch is available for review at http://codereview.appspot.com/4823059

Patch

Index: gcc/cp/ChangeLog.pph

2011-07-28   Lawrence Crowl  <crowl@google.com>

	* pt.c (pph_in_tinst_level): Put tinst_level list in forward order.


Index: gcc/cp/pt.c
===================================================================
--- gcc/cp/pt.c	(revision 176905)
+++ gcc/cp/pt.c	(working copy)
@@ -19738,20 +19738,24 @@  pph_dump_tinst_level (FILE *stream, stru
 static struct tinst_level *
 pph_in_tinst_level (pph_stream *stream)
 {
+  struct tinst_level *head = NULL;
   struct tinst_level *last = NULL;
   unsigned count = pph_in_uint (stream);
-  /* FIXME pph: This leaves the list in reverse order.  Issue?  */
   for (; count > 0; --count)
     {
       struct tinst_level *cur = ggc_alloc_tinst_level ();
-      cur->next = last;
+      cur->next = NULL;
       cur->decl = pph_in_tree (stream);
       cur->locus = pph_in_location (stream);
       cur->errors = pph_in_uint (stream);
       cur->in_system_header_p = pph_in_uint (stream);
+      if (head == NULL)
+          head = cur;
+      else
+          last->next = cur;
       last = cur;
     }
-  return last;
+  return head;
 }