]> thyrsus.com Git - mad.git/commitdiff
Error-checking for udimensioned arrays.
authorEric S. Raymond <esr@thyrsus,com>
Thu, 19 Feb 2004 23:44:03 +0000 (23:44 +0000)
committerEric S. Raymond <esr@thyrsus,com>
Thu, 19 Feb 2004 23:44:03 +0000 (23:44 +0000)
mad

diff --git a/mad b/mad
index f9a633f5ff29c3cd54945ffd0ffbf50b40b55a93..374c165285197fcf58a6dadfe8aec7ae7bf8dd8f 100755 (executable)
--- a/mad
+++ b/mad
@@ -736,7 +736,10 @@ def prinC1(t):
             else:
                 # More than one subscript; this is where we implement MAD's
                 # weird reliance on dope vectors.
-                ptr = dimensions[t[1]][1]
+                try:
+                    ptr = dimensions[t[1]][1]
+                except KeyError:
+                    fatal("attempt to reference undimensioned array %s" % t[1])
                 if len(dimensions[t[1]]) > 2:
                     ptr = ptr + "+" + dimensions[t[1]][2]
                 subscript = 'MAD' + `len(t[2])` + '(' + ptr + "," + ','.join(map(print_C_expr, t[2])) + ')'