From 8a20b900744529c01c5359a1a82fba0e452dd12c Mon Sep 17 00:00:00 2001 From: "R. Timothy Edwards" Date: Mon, 8 Dec 2025 13:09:50 -0500 Subject: [PATCH 1/2] Corrected an issue that can cause a segfault in an incorrect run setup when a cell has no pins. Didn't really analyze the error condition, just caught and handled the condition to avoid the segfault. --- VERSION | 2 +- base/netcmp.c | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 42246ba..fdd8146 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.311 +1.5.312 diff --git a/base/netcmp.c b/base/netcmp.c index 38774c8..587b7b1 100644 --- a/base/netcmp.c +++ b/base/netcmp.c @@ -7544,6 +7544,11 @@ struct nlist *addproxies(struct hashlist *p, void *clientdata) } else { lob = ob; + if (ob == NULL) { + Fprintf(stdout, "Error: Premature end of pin list on " + "instance %s.\n", firstpin->instance.name); + break; + } ob->type = i++; ob = ob->next; } From c0c99939808e2575dd6c8ff93554a8f57a81ab6c Mon Sep 17 00:00:00 2001 From: "R. Timothy Edwards" Date: Mon, 8 Dec 2025 16:45:27 -0500 Subject: [PATCH 2/2] Corrected a major error with the verilog parser. The verilog parser was not assigning the correct file number for the first input file, which resulted in the effect that if the first file read sets definitions for the netlist, then those definitions are wiped out on the following file read. There has been a workaround to read from /dev/null on the first file read so that the file number is set on all subsequent reads. This fix avoids the need for the workaround. --- base/verilog.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/base/verilog.c b/base/verilog.c index 0201afe..7468af8 100644 --- a/base/verilog.c +++ b/base/verilog.c @@ -76,7 +76,8 @@ struct hashdict verilogparams; // Global storage for verilog definitions struct hashdict verilogdefs; // Record file pointer that is associated with the hash tables -int hashfile = -1; +int hashfilep = -1; /* for parameters */ +int hashfiled = -1; /* for definitions */ // Global storage for wire buses struct hashdict buses; @@ -2999,18 +3000,25 @@ char *ReadVerilogTop(char *fname, int *fnum, int blackbox) hashfunc = hashcase; } - if ((hashfile != -1) && (hashfile != *fnum)) { - /* Started a new file, so remove all the parameters and definitions */ + if ((hashfilep != -1) && (hashfilep != *fnum)) { + /* Started a new file, so remove all the parameters */ RecurseHashTable(&verilogparams, freeprop); HashKill(&verilogparams); + hashfilep = -1; + } + if ((hashfiled != -1) && (hashfiled != *fnum)) { + /* Started a new file, so remove all the definitions */ RecurseHashTable(&verilogdefs, freeprop); HashKill(&verilogdefs); - hashfile = -1; + hashfiled = -1; } - if (hashfile == -1) { + if (hashfilep == -1) { InitializeHashTable(&verilogparams, OBJHASHSIZE); + hashfilep = filenum; + } + if (hashfiled == -1) { InitializeHashTable(&verilogdefs, OBJHASHSIZE); - hashfile = *fnum; + hashfiled = filenum; } definitions = &verilogdefs;