From: ceriel Date: Wed, 22 Jul 1987 10:59:24 +0000 (+0000) Subject: some more fixes X-Git-Tag: release-5-5~3991 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=0bffe65c24e358e8403a3f59a9d8f86638df2dbc;p=ack.git some more fixes --- diff --git a/lang/m2/comp/Makefile b/lang/m2/comp/Makefile index 904dbbe8c..13df19bf3 100644 --- a/lang/m2/comp/Makefile +++ b/lang/m2/comp/Makefile @@ -239,6 +239,7 @@ enter.o: LLlex.h enter.o: debug.h enter.o: debugcst.h enter.o: def.h +enter.o: f_info.h enter.o: idf.h enter.o: main.h enter.o: misc.h diff --git a/lang/m2/comp/Version.c b/lang/m2/comp/Version.c index 5fbfc3909..77b2f4136 100644 --- a/lang/m2/comp/Version.c +++ b/lang/m2/comp/Version.c @@ -1 +1 @@ -static char Version[] = "ACK Modula-2 compiler Version 0.12"; +static char Version[] = "ACK Modula-2 compiler Version 0.13"; diff --git a/lang/m2/comp/code.c b/lang/m2/comp/code.c index 0c83f7006..0e189f261 100644 --- a/lang/m2/comp/code.c +++ b/lang/m2/comp/code.c @@ -132,7 +132,6 @@ CodeExpr(nd, ds, true_label, false_label) ds->dsg_kind = DSG_LOADED; break; - case Xset: case Set: { register unsigned i = (unsigned) (tp->tp_size) / (int) word_size; register arith *st = nd->nd_set + i; @@ -397,8 +396,14 @@ CodeParameters(param, arg) if (left->nd_symb == STRING) { CodeString(left); } - else if (left->nd_class == Call || left->nd_class == Value) { - /* ouch! forgot about these ones! */ + else switch(left->nd_class) { + case Arrsel: + case Arrow: + case Def: + case LinkDef: + CodeDAddress(left); + break; + default:{ arith tmp, TmpSpace(); CodePExpr(left); @@ -406,8 +411,9 @@ CodeParameters(param, arg) C_lal(tmp); C_sti(WA(left->nd_type->tp_size)); C_lal(tmp); + } + break; } - else CodeDAddress(left); return; } if (IsVarParam(param)) { diff --git a/lang/m2/comp/declar.g b/lang/m2/comp/declar.g index 51c5b2e68..d6f89c3d1 100644 --- a/lang/m2/comp/declar.g +++ b/lang/m2/comp/declar.g @@ -414,6 +414,7 @@ SetType(struct type **ptp;) : type-identifiers */ PointerType(register struct type **ptp;) : + { *ptp = construct_type(T_POINTER, NULLTYPE); } POINTER TO [ %if (type_or_forward(ptp)) type(&((*ptp)->tp_next)) diff --git a/lang/m2/comp/enter.c b/lang/m2/comp/enter.c index d8d7f4693..1f0939722 100644 --- a/lang/m2/comp/enter.c +++ b/lang/m2/comp/enter.c @@ -25,6 +25,7 @@ #include "node.h" #include "main.h" #include "misc.h" +#include "f_info.h" struct def * Enter(name, kind, type, pnam) @@ -463,12 +464,16 @@ EnterImportList(Idlist, local) register struct node *idlist = Idlist; struct scope *sc = enclosing(CurrVis)->sc_scope; extern struct def *GetDefinitionModule(); + struct f_info f; + + f = file_info; for (; idlist; idlist = idlist->nd_left) { DoImport(local ? ForwDef(idlist, sc) : GetDefinitionModule(idlist->nd_IDF, 1) , CurrentScope); + file_info = f; } FreeNode(Idlist); } diff --git a/lang/m2/comp/type.c b/lang/m2/comp/type.c index b4289d4ed..810f6369f 100644 --- a/lang/m2/comp/type.c +++ b/lang/m2/comp/type.c @@ -590,7 +590,6 @@ type_or_forward(ptp) register struct node *nd; register struct def *df1; - *ptp = construct_type(T_POINTER, NULLTYPE); if ((df1 = lookup(dot.TOK_IDF, CurrentScope, 1))) { /* Either a Module or a Type, but in both cases defined in this scope, so this is the correct identification diff --git a/lang/m2/comp/walk.c b/lang/m2/comp/walk.c index edf1846c5..73bf05ea7 100644 --- a/lang/m2/comp/walk.c +++ b/lang/m2/comp/walk.c @@ -574,6 +574,7 @@ node_error(right, "type incompatibility in RETURN statement"); CodePString(right, func_type); } else CodePExpr(right); + RangeCheck(func_type, right->nd_type); } C_bra(RETURN_LABEL); break;