do not allow reals as case labels, check size of array's

This commit is contained in:
ceriel 1987-11-24 13:22:04 +00:00
parent 067eace890
commit ea2c86ef0c
3 changed files with 7 additions and 1 deletions

View file

@ -1 +1 @@
static char Version[] = "ACK Modula-2 compiler Version 0.27";
static char Version[] = "ACK Modula-2 compiler Version 0.28";

View 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);

View 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.
*/