compiler could not handle using addresses of procedures declared
authorceriel <none@none>
Mon, 24 Aug 1987 11:42:37 +0000 (11:42 +0000)
committerceriel <none@none>
Mon, 24 Aug 1987 11:42:37 +0000 (11:42 +0000)
in imported definition modules. This is corrected

lang/m2/comp/Version.c
lang/m2/comp/code.c
lang/m2/comp/def.H
lang/m2/comp/def.c
lang/m2/comp/type.c

index 29da44a..037046d 100644 (file)
@@ -1 +1 @@
-static char Version[] = "ACK Modula-2 compiler Version 0.14";
+static char Version[] = "ACK Modula-2 compiler Version 0.15";
index 96ba137..4fa5c8c 100644 (file)
@@ -37,6 +37,19 @@ extern int   proclevel;
 extern char    options[];
 int            fp_used;
 
+STATIC char *
+NameOfProc(df)
+       register struct def *df;
+{
+
+       assert(df->df_kind & (D_PROCHEAD|D_PROCEDURE));
+
+       if (df->df_kind == D_PROCEDURE) {
+               return df->prc_vis->sc_scope->sc_name;
+       }
+       return df->for_name;
+}
+
 CodeConst(cst, size)
        arith cst;
        int size;
@@ -293,7 +306,6 @@ CodeCall(nd)
                and result is already done.
        */
        register struct node *left = nd->nd_left;
-       register struct def *df;
        register struct node *right = nd->nd_right;
        register struct type *result_tp;
 
@@ -319,19 +331,13 @@ CodeCall(nd)
 
        switch(left->nd_class) {
        case Def: {
-               df = left->nd_def;
-
-               if (df->df_kind == D_PROCEDURE) {
-                       int level = df->df_scope->sc_level;
+               if (left->nd_def->df_kind & (D_PROCEDURE|D_PROCHEAD)) {
+                       int level = left->nd_def->df_scope->sc_level;
 
                        if (level > 0) {
                                C_lxl((arith) (proclevel - level));
                        }
-                       C_cal(NameOfProc(df));
-                       break;
-               }
-               else if (df->df_kind == D_PROCHEAD) {
-                       C_cal(df->for_name);
+                       C_cal(NameOfProc(left->nd_def));
                        break;
                }}
                /* Fall through */
index 0635fd0..ebedc97 100644 (file)
@@ -53,7 +53,6 @@ struct dfproc {
        struct node *pr_body;   /* body of this procedure */
 #define prc_vis                df_value.df_proc.pr_vis
 #define prc_body       df_value.df_proc.pr_body
-#define NameOfProc(xdf)        ((xdf)->prc_vis->sc_scope->sc_name)
 };
 
 struct import {
index 6cbe9ba..ca11c87 100644 (file)
@@ -279,8 +279,8 @@ DeclProc(type, id)
                scope = CurrentScope;
                scope->sc_name = name;
                scope->sc_definedby = df;
-               df->prc_vis = CurrVis;
        }
+       df->prc_vis = CurrVis;
 
        return df;
 }
index 91430f9..bde89b7 100644 (file)
@@ -313,8 +313,6 @@ chk_basesubrange(tp, base)
        }
 
        tp->tp_next = base;
-       tp->tp_size = base->tp_size;
-       tp->tp_align = base->tp_align;
 }
 
 int
@@ -374,8 +372,6 @@ subr_type(lb, ub)
        res = construct_type(T_SUBRANGE, tp);
        res->sub_lb = lb->nd_INT;
        res->sub_ub = ub->nd_INT;
-       res->tp_size = tp->tp_size;
-       res->tp_align = tp->tp_align;
        if (tp == card_type) {
                u_small(res, res->sub_ub);
        }