From b5f188de42742fe3faffe901ee2b2733568be524 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Tue, 10 Oct 2017 22:24:09 -0400 Subject: [PATCH] Corrected two errors in the serial combine function, one which misses a device if it has been already moved due to earlier merging in the serial combine routine, and runs off the end of the list; the other if the pin check routine falls on the last device in the list, leading to an incorrect check for a record where there is only a NULL. --- base/netgen.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/base/netgen.c b/base/netgen.c index 258878a..cc8860f 100644 --- a/base/netgen.c +++ b/base/netgen.c @@ -3309,7 +3309,9 @@ int check_pin_nodes(struct objlist *ob1, struct objlist *ob2) pob = pob->next; } - if (nob->type > FIRSTPIN || pob->type > FIRSTPIN) return FALSE; + if (nob && pob && (nob->type > FIRSTPIN || pob->type > FIRSTPIN)) + return FALSE; + return TRUE; } @@ -3486,7 +3488,13 @@ int CombineSerial(char *model, int file) /* only pointer to it. */ for (obp = instlist[i][0]; obp->next->type > FIRSTPIN || obp->next->type == PROPERTY; obp = obp->next); - for (ob2 = obp; ob2->next != instlist[i][1]; ob2 = ob2->next); + for (ob2 = obp; ob2 && ob2->next != instlist[i][1]; ob2 = ob2->next); + + /* Device may have been moved by the above code. If so, look for */ + /* it from the beginning of the list. */ + if (ob2 == NULL) + for (ob2 = tp->cell; ob2->next != instlist[i][1]; ob2 = ob2->next); + for (obs = ob2->next; obs->next && (obs->next->type > FIRSTPIN || obs->next->type == PROPERTY); obs = obs->next); ob2->next = obs->next;