Blame test/delarpm2.awk

Packit 575503
# From beebe@math.utah.edu  Sat May 17 21:31:27 2003
Packit 575503
# Return-Path: <beebe@math.utah.edu>
Packit 575503
# Received: from localhost (aahz [127.0.0.1])
Packit 575503
# 	by skeeve.com (8.12.5/8.12.5) with ESMTP id h4HIQmCw001380
Packit 575503
# 	for <arnold@localhost>; Sat, 17 May 2003 21:31:27 +0300
Packit 575503
# Received: from actcom.co.il [192.114.47.1]
Packit 575503
# 	by localhost with POP3 (fetchmail-5.9.0)
Packit 575503
# 	for arnold@localhost (single-drop); Sat, 17 May 2003 21:31:27 +0300 (IDT)
Packit 575503
# Received: by actcom.co.il (mbox arobbins)
Packit 575503
#  (with Cubic Circle's cucipop (v1.31 1998/05/13) Sat May 17 21:34:07 2003)
Packit 575503
# X-From_: beebe@sunshine.math.utah.edu Fri May 16 20:38:45 2003
Packit 575503
# Received: from smtp1.actcom.net.il by actcom.co.il  with ESMTP
Packit 575503
# 	(8.11.6/actcom-0.2) id h4GHcd226764 for <arobbins@actcom.co.il>;
Packit 575503
# 	Fri, 16 May 2003 20:38:40 +0300 (EET DST)  
Packit 575503
# 	(rfc931-sender: mail.actcom.co.il [192.114.47.13])
Packit 575503
# Received: from f7.net (consort.superb.net [209.61.216.22])
Packit 575503
# 	by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h4GHgBc2023067
Packit 575503
# 	for <arobbins@actcom.co.il>; Fri, 16 May 2003 20:42:13 +0300
Packit 575503
# Received: from sunshine.math.utah.edu (sunshine.math.utah.edu [128.110.198.2])
Packit 575503
# 	by f7.net (8.11.7/8.11.6) with ESMTP id h4GHcbf09202
Packit 575503
# 	for <arnold@skeeve.com>; Fri, 16 May 2003 13:38:37 -0400
Packit 575503
# Received: from suncore.math.utah.edu (IDENT:r8KQWmkF4jVMLBhxpojXGNCAnBZB38ET@suncore.math.utah.edu [128.110.198.5])
Packit 575503
# 	by sunshine.math.utah.edu (8.9.3p2/8.9.3) with ESMTP id LAA09111;
Packit 575503
# 	Fri, 16 May 2003 11:38:34 -0600 (MDT)
Packit 575503
# Received: (from beebe@localhost)
Packit 575503
# 	by suncore.math.utah.edu (8.9.3p2/8.9.3) id LAA01743;
Packit 575503
# 	Fri, 16 May 2003 11:38:34 -0600 (MDT)
Packit 575503
# Date: Fri, 16 May 2003 11:38:34 -0600 (MDT)
Packit 575503
# From: "Nelson H. F. Beebe" <beebe@math.utah.edu>
Packit 575503
# To: "Arnold Robbins" <arnold@skeeve.com>
Packit 575503
# Cc: beebe@math.utah.edu
Packit 575503
# X-US-Mail: "Center for Scientific Computing, Department of Mathematics, 110
Packit 575503
#         LCB, University of Utah, 155 S 1400 E RM 233, Salt Lake City, UT
Packit 575503
#         84112-0090, USA"
Packit 575503
# X-Telephone: +1 801 581 5254
Packit 575503
# X-FAX: +1 801 585 1640, +1 801 581 4148
Packit 575503
# X-URL: http://www.math.utah.edu/~beebe
Packit 575503
# Subject: gawk-3.1.2[ab]: bug in delete
Packit 575503
# Message-ID: <CMM.0.92.0.1053106714.beebe@suncore.math.utah.edu>
Packit 575503
# 
Packit 575503
# I discovered yesterday that one of my tools got broken by the upgrade
Packit 575503
# to gawk-3.1.2a and gawk-3.1.2b.  For now, I've temporarily reset
Packit 575503
# /usr/local/bin/gawk on the Sun Solaris and Intel GNU/Linux systems
Packit 575503
# back to be gawk-3.1.2.
Packit 575503
# 
Packit 575503
# This morning, I isolated the problem to the following small test case:
Packit 575503
# 
Packit 575503
# 	% cat bug.awk
Packit 575503
	BEGIN {
Packit 575503
	    clear_array(table)
Packit 575503
	    foo(table)
Packit 575503
	    for (key in table)
Packit 575503
		print key, table[k]
Packit 575503
	    clear_array(table)
Packit 575503
	    exit(0)
Packit 575503
	}
Packit 575503
Packit 575503
	function clear_array(array, key)
Packit 575503
	{
Packit 575503
	    for (key in array)
Packit 575503
		delete array[key]
Packit 575503
	}
Packit 575503
Packit 575503
	function foo(a)
Packit 575503
	{
Packit 575503
	    a[1] = "one"
Packit 575503
	    a[2] = "two"
Packit 575503
	}
Packit 575503
# 
Packit 575503
# With nawk, mawk, and also gawk-3.1.2 or earlier, I get this:
Packit 575503
# 
Packit 575503
# 	% mawk -f bug.awk
Packit 575503
# 	1
Packit 575503
# 	2
Packit 575503
# 
Packit 575503
# However, with the two most recent gawk releases, I get:
Packit 575503
# 
Packit 575503
# 	% gawk-3.1.2b -f bug.awk
Packit 575503
# 	gawk-3.1.2b: bug.awk:12: fatal: delete: illegal use of variable `table' as
Packit 575503
# 	array
Packit 575503
# 
Packit 575503
# If the first clear_array() statement is commented out, it runs.
Packit 575503
# However, the problem is that in a large program, it may not be easy to
Packit 575503
# identify places where it is safe to invoke delete, so I believe the
Packit 575503
# old behavior is more desirable.
Packit 575503
# 
Packit 575503
# -------------------------------------------------------------------------------
Packit 575503
# - Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
Packit 575503
# - Center for Scientific Computing       FAX: +1 801 581 4148                  -
Packit 575503
# - University of Utah                    Internet e-mail: beebe@math.utah.edu  -
Packit 575503
# - Department of Mathematics, 110 LCB        beebe@acm.org  beebe@computer.org -
Packit 575503
# - 155 S 1400 E RM 233                       beebe@ieee.org                    -
Packit 575503
# - Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe  -
Packit 575503
# -------------------------------------------------------------------------------
Packit 575503
#