From fc6a8c5aa8cd2c86829a277a8c1f44b1d73baf59 Mon Sep 17 00:00:00 2001 From: ceriel Date: Wed, 14 Oct 1987 12:34:47 +0000 Subject: [PATCH] some minor fixes --- lang/m2/comp/chk_expr.c | 5 +++-- lang/m2/comp/chk_expr.h | 1 + lang/m2/comp/def.c | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lang/m2/comp/chk_expr.c b/lang/m2/comp/chk_expr.c index b8e92e82f..03621e775 100644 --- a/lang/m2/comp/chk_expr.c +++ b/lang/m2/comp/chk_expr.c @@ -422,7 +422,7 @@ MkSet(size) { register arith *s; - size += sizeof(arith); + size = ((size + (int)word_size - 1) / (int)word_size + 1) * sizeof(arith); s = (arith *) Malloc(size); clear((char *) s , size); s++; @@ -433,6 +433,7 @@ MkSet(size) FreeSet(s) register arith *s; { + dec_refcount(s); if (refcount(s) <= 0) { free((char *) (s-1)); } @@ -482,7 +483,7 @@ ChkSet(expp) First allocate room for the set. */ - expp->nd_set = MkSet((unsigned)(tp->tp_size) * (sizeof(arith) / (int) word_size)); + expp->nd_set = MkSet((unsigned)(tp->tp_size)); /* Now check the elements, one by one */ diff --git a/lang/m2/comp/chk_expr.h b/lang/m2/comp/chk_expr.h index e45cdacc9..4db3ad15b 100644 --- a/lang/m2/comp/chk_expr.h +++ b/lang/m2/comp/chk_expr.h @@ -20,4 +20,5 @@ extern int (*DesigChkTable[])(); /* table of designator checking #define ChkDesignator(expp) ((*DesigChkTable[(expp)->nd_class])(expp)) #define inc_refcount(s) (*((s) - 1) += 1) +#define dec_refcount(s) (*((s) - 1) -= 1) #define refcount(s) (*((s) - 1)) diff --git a/lang/m2/comp/def.c b/lang/m2/comp/def.c index 21ecfbd22..6442453dc 100644 --- a/lang/m2/comp/def.c +++ b/lang/m2/comp/def.c @@ -360,10 +360,12 @@ CheckWithDef(df, tp) possible earlier definition in the definition module. */ - if (df->df_type) { + if (df->df_kind == D_PROCHEAD && df->df_type != error_type) { /* We already saw a definition of this type in the definition module. */ + assert(df->df_type != 0); + if (!TstProcEquiv(tp, df->df_type)) { error("inconsistent procedure declaration for \"%s\"", df->df_idf->id_text); -- 2.34.1