From 8a331f82a897ad58359a65943becc498b89911b6 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 19 Feb 2004 23:44:03 +0000 Subject: [PATCH] Error-checking for udimensioned arrays. --- mad | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mad b/mad index f9a633f..374c165 100755 --- 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])) + ')' -- 2.43.0