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

2011-07-28 Thread Lawrence Crowl
Place the tinst_level list in forward order.

Tested on x64.


Index: gcc/cp/ChangeLog.pph

2011-07-28   Lawrence Crowl  cr...@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;
 }
 
 

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


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

2011-07-28 Thread gchare

LGTM

http://codereview.appspot.com/4823059/