From: ceriel Date: Tue, 24 Nov 1987 13:22:04 +0000 (+0000) Subject: do not allow reals as case labels, check size of array's X-Git-Tag: release-5-5~3713 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=ea2c86ef0cb1462364e93115915f4cbf4b30a364;p=ack.git do not allow reals as case labels, check size of array's --- diff --git a/lang/m2/comp/Version.c b/lang/m2/comp/Version.c index 42bac3577..9b8c4cefb 100644 --- a/lang/m2/comp/Version.c +++ b/lang/m2/comp/Version.c @@ -1 +1 @@ -static char Version[] = "ACK Modula-2 compiler Version 0.27"; +static char Version[] = "ACK Modula-2 compiler Version 0.28"; diff --git a/lang/m2/comp/declar.g b/lang/m2/comp/declar.g index aa5385148..d71ce2001 100644 --- a/lang/m2/comp/declar.g +++ b/lang/m2/comp/declar.g @@ -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); diff --git a/lang/m2/comp/type.c b/lang/m2/comp/type.c index 4f032aa56..3a9a31d79 100644 --- a/lang/m2/comp/type.c +++ b/lang/m2/comp/type.c @@ -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. */