diff mbox

[pph] pph_in_binding_level fixing shadowed_labels read (issue4589054)

Message ID 20110614175932.C7EB01C3747@gchare.mtv.corp.google.com
State New
Headers show

Commit Message

Gab Charette June 14, 2011, 5:59 p.m. UTC
We weren't reading in shadowed labels properly.

The local variable *sl also turned out to be useless, the compiler just didn't
mention it until now as it was "used" by the bad VEC_iterate call.

This doesn't fix any currently exposed pph bugs, but does help with me with
the patch I'm currently writting.

This was tested with a bootstrap build and pph regression testing.


2011-06-14  Gabriel Charette  <gchare@google.com>

	* pph-streamer-in.c (pph_in_binding_level): Fix read
	of shadowed_labels.
	(pph_in_binding_level): Removed *sl.


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

Comments

Diego Novillo June 14, 2011, 7:29 p.m. UTC | #1
On Tue, Jun 14, 2011 at 13:59, Gabriel Charette <gchare@google.com> wrote:

> 2011-06-14  Gabriel Charette  <gchare@google.com>
>
>        * pph-streamer-in.c (pph_in_binding_level): Fix read
>        of shadowed_labels.
>        (pph_in_binding_level): Removed *sl.

OK, committed as rev 175050.


Diego.
diff mbox

Patch

Index: pph-streamer-in.c
===================================================================
--- pph-streamer-in.c	(revision 174998)
+++ pph-streamer-in.c	(working copy)
@@ -427,7 +427,6 @@ 
 pph_in_binding_level (pph_stream *stream)
 {
   unsigned i, num, ix;
-  cp_label_binding *sl;
   struct cp_binding_level *bl;
   struct bitpack_d bp;
   enum pph_record_marker marker;
@@ -461,7 +460,7 @@ 
 
   num = pph_in_uint (stream);
   bl->shadowed_labels = NULL;
-  for (i = 0; VEC_iterate (cp_label_binding, bl->shadowed_labels, i, sl); i++)
+  for (i = 0; i < num; i++)
     {
       cp_label_binding *sl = pph_in_label_binding (stream);
       VEC_safe_push (cp_label_binding, gc, bl->shadowed_labels, sl);