From 35ae1ece8c12c8401c6303773fe3ab1507200339 Mon Sep 17 00:00:00 2001 From: Giles Atkinson <“gatk555@gmail.com”> Date: Tue, 11 Mar 2025 21:09:44 +0000 Subject: [PATCH] Add an error message for a .model line that includes a default value for a read-only instance parameter. Before that caused a fatal error in parsing the first device to use the model. --- src/spicelib/parser/inpgmod.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/spicelib/parser/inpgmod.c b/src/spicelib/parser/inpgmod.c index bc98e770b..64c402d7e 100644 --- a/src/spicelib/parser/inpgmod.c +++ b/src/spicelib/parser/inpgmod.c @@ -149,12 +149,18 @@ create_model(CKTcircuit *ckt, INPmodel *modtmp, INPtables *tab) if (p) { char *value; - INPgetTok(&line, &value, 1); - modtmp->INPmodfast->defaults = - wl_cons(copy(parm), - wl_cons(value, - modtmp->INPmodfast->defaults)); + INPgetTok(&line, &value, 1); + if (p->dataType & IF_SET) { + modtmp->INPmodfast->defaults = + wl_cons(copy(parm), + wl_cons(value, modtmp->INPmodfast->defaults)); + } else { + fprintf(stderr, + "Ignoring attempt to set a default " + "for read-only instance parameter %s in:\n %s\n", + p->keyword, modtmp->INPmodLine->line); + } } else { double dval;