Prevented a crash condition in the error case in which ports are

unordered at the time of reaching reorderpins().  Pins will be
ordered arbitrarily (in the order of appearance in the linked
list), but netgen will not crash.
This commit is contained in:
Tim Edwards 2017-08-24 09:50:40 -04:00
parent 9d476bc25a
commit af3982766e
1 changed files with 10 additions and 1 deletions

View File

@ -6057,7 +6057,7 @@ int reorderpins(struct hashlist *p, int file)
struct nlist *ptr;
struct nlist *tc2 = Circuit2;
struct objlist *ob, *ob2, *firstpin;
int i, numports, *nodes;
int i, numports, *nodes, unordered;
char **names;
ptr = (struct nlist *)(p->ptr);
@ -6071,14 +6071,23 @@ int reorderpins(struct hashlist *p, int file)
/* instances of both cells. */
numports = 0;
unordered = 0;
ob2 = tc2->cell;
while (ob2 && ob2->type == PORT) {
if (ob2->model.port < 0) {
ob2->model.port = numports;
unordered = 1;
}
numports++;
ob2 = ob2->next;
}
nodes = (int *)CALLOC(numports, sizeof(int));
names = (char **)CALLOC(numports, sizeof(char *));
if (unordered)
Fprintf(stderr, "Ports of %s are unordered. "
"Ordering will be arbitrary.", tc2->name);
for (ob = ptr->cell; ob != NULL; ) {
if (ob->type == FIRSTPIN) {
if ((*matchfunc)(ob->model.class, tc2->name)) {