do not allow reals as case labels, check size of array's
authorceriel <none@none>
Tue, 24 Nov 1987 13:22:04 +0000 (13:22 +0000)
committerceriel <none@none>
Tue, 24 Nov 1987 13:22:04 +0000 (13:22 +0000)
lang/m2/comp/Version.c
lang/m2/comp/declar.g
lang/m2/comp/type.c

index 42bac35..9b8c4ce 100644 (file)
@@ -1 +1 @@
-static char Version[] = "ACK Modula-2 compiler Version 0.27";
+static char Version[] = "ACK Modula-2 compiler Version 0.28";
index aa53851..d71ce20 100644 (file)
@@ -404,6 +404,9 @@ CaseLabels(t_type **ptp; register t_node **pnd;)
                                ChkCompat(pnd, *ptp, "case label");
                          }
                          nd = *pnd;
+                         if (! (nd->nd_type->tp_fund & T_DISCRETE)) {
+                               node_error(nd, "illegal type in case label");
+                         }
                        }
        [
                UPTO    { *pnd = nd = dot2node(Link,nd,NULLNODE);
index 4f032aa..3a9a31d 100644 (file)
@@ -538,6 +538,9 @@ ArraySizes(tp)
        diff = hi - lo;
 
        tp->tp_size = (diff + 1) * tp->arr_elsize;
+       if (! fit(tp->tp_size, (int) word_size)) {
+               error("array too large");
+       }
 
        /* generate descriptor and remember label.
        */