# r5714 - trunk/eda/fped

werner at docs.openmoko.org werner at docs.openmoko.org
Fri Nov 27 20:18:44 CET 2009

```Author: werner
Date: 2009-11-27 20:18:44 +0100 (Fri, 27 Nov 2009)
New Revision: 5714

Modified:
trunk/eda/fped/inst.c
Log:
Fixed some bugs in the vector list re-ordering function. This should work now,
but there's another problem in the dumping code that still spoils the fun.

- inst.c (do_move_to_vec): marking algorithm propagated an uninitialized value
- inst.c (do_move_to_vec): we have to clear the marks of vectors that are
before the vector being moved, because they will still be visited and
propagated

Modified: trunk/eda/fped/inst.c
===================================================================
--- trunk/eda/fped/inst.c	2009-11-27 16:23:35 UTC (rev 5713)
+++ trunk/eda/fped/inst.c	2009-11-27 19:18:44 UTC (rev 5714)
@@ -635,11 +635,14 @@
* Mark the vector that's being rebased and all vectors that
* (recursively) depend on it.
*
-	 * We're only interested in the range between the vector being moved
+	 * We're mainly interested in the range between the vector being moved
* and the new base. If the vector follows the base, the list is
* already in the correct order and nothing needs moving.
*/
-	for (v = vec; v && v != to_vec; v = v->next)
+	for (v = frame->vecs; v != vec; v = v->next)
+		v->mark = 0;
+	vec->mark = 1;
+	for (v = vec->next; v && v != to_vec; v = v->next)
v->mark = v->base ? v->base->mark : 0;
if (!v)
return;
@@ -647,6 +650,9 @@
/*
* All the marked vectors appearing on the list before the new base
* are moved after the new base, preserving their order.
+	 *
+	 * Start at frame->vecs, not "vec", so that we move the the vector
+	 * being rebased as well.
*/
anchor = &to_vec->next;
walk = &frame->vecs;

```