xref: /illumos-gate/usr/src/test/util-tests/tests/awk/gnu/delarprm.awk (revision 3ee4fc2aa6b5136515cc3eed32d3c6ef33e37471)
1*3ee4fc2aSCody Peter Mello# From dragon!unagi.cis.upenn.edu!sjanet Tue Mar 25 17:12:20 1997
2*3ee4fc2aSCody Peter Mello# Return-Path: <dragon!unagi.cis.upenn.edu!sjanet>
3*3ee4fc2aSCody Peter Mello# Received: by skeeve.atl.ga.us (/\==/\ Smail3.1.22.1 #22.1)
4*3ee4fc2aSCody Peter Mello# 	id <m0w9eS4-000GWyC@skeeve.atl.ga.us>; Tue, 25 Mar 97 17:12 EST
5*3ee4fc2aSCody Peter Mello# Received: by vecnet.com (DECUS UUCP /2.0/2.0/2.0/);
6*3ee4fc2aSCody Peter Mello#           Tue, 25 Mar 97 16:58:36 EDT
7*3ee4fc2aSCody Peter Mello# Received: from gnu-life.ai.mit.edu by antaries.vec.net (MX V4.2 VAX) with SMTP;
8*3ee4fc2aSCody Peter Mello#           Tue, 25 Mar 1997 16:58:26 EST
9*3ee4fc2aSCody Peter Mello# Received: from linc.cis.upenn.edu by gnu-life.ai.mit.edu (8.8.5/8.6.12GNU) with
10*3ee4fc2aSCody Peter Mello#           ESMTP id QAA24350 for <bug-gnu-utils@prep.ai.mit.edu>; Tue, 25 Mar
11*3ee4fc2aSCody Peter Mello#           1997 16:56:59 -0500 (EST)
12*3ee4fc2aSCody Peter Mello# Received: from unagi.cis.upenn.edu (UNAGI.CIS.UPENN.EDU [158.130.8.153]) by
13*3ee4fc2aSCody Peter Mello#           linc.cis.upenn.edu (8.8.5/8.8.5) with ESMTP id QAA09424; Tue, 25 Mar
14*3ee4fc2aSCody Peter Mello#           1997 16:56:54 -0500 (EST)
15*3ee4fc2aSCody Peter Mello# Received: (from sjanet@localhost) by unagi.cis.upenn.edu (8.8.5/8.8.5) id
16*3ee4fc2aSCody Peter Mello#           QAA03969; Tue, 25 Mar 1997 16:56:50 -0500 (EST)
17*3ee4fc2aSCody Peter Mello# Date: Tue, 25 Mar 1997 16:56:50 -0500 (EST)
18*3ee4fc2aSCody Peter Mello# From: Stan Janet <sjanet@unagi.cis.upenn.edu>
19*3ee4fc2aSCody Peter Mello# Message-ID: <199703252156.QAA03969@unagi.cis.upenn.edu>
20*3ee4fc2aSCody Peter Mello# To: bug-gnu-utils@prep.ai.mit.edu
21*3ee4fc2aSCody Peter Mello# CC: arnold@gnu.ai.mit.edu
22*3ee4fc2aSCody Peter Mello# Subject: GNU awk 3.0.2 bug: fatal error deleting local array inside function
23*3ee4fc2aSCody Peter Mello# Status: ORf
24*3ee4fc2aSCody Peter Mello#
25*3ee4fc2aSCody Peter Mello# Version: GNU Awk 3.0.2
26*3ee4fc2aSCody Peter Mello# Platforms: SunOS 4.1.1 (compiled with Sun cc)
27*3ee4fc2aSCody Peter Mello#            IRIX 5.3 (compiled with SGI cc)
28*3ee4fc2aSCody Peter Mello# Problem: Deleting local array inside function causes fatal internal error (and
29*3ee4fc2aSCody Peter Mello# 	core dump. The error does not occur when the variable "x", unused in
30*3ee4fc2aSCody Peter Mello# 	the example, is removed or when the function is declared foo(x,p).
31*3ee4fc2aSCody Peter Mello# 	When the function is declared foo(p,x), adding a dummy line that uses
32*3ee4fc2aSCody Peter Mello# 	"x", e.g. "x=1" does not prevent the error. If "p" is not deleted,
33*3ee4fc2aSCody Peter Mello# 	there is no error. If "p[1]" is used to delete the lone element, there
34*3ee4fc2aSCody Peter Mello# 	is no error.
35*3ee4fc2aSCody Peter Mello#
36*3ee4fc2aSCody Peter Mello# ==== The program x.gawk ====
37*3ee4fc2aSCody Peter Mello
38*3ee4fc2aSCody Peter Mellofunction foo(p,x) {
39*3ee4fc2aSCody Peter Mello	p[1]="bar"
40*3ee4fc2aSCody Peter Mello	delete p
41*3ee4fc2aSCody Peter Mello	return 0
42*3ee4fc2aSCody Peter Mello}
43*3ee4fc2aSCody Peter Mello
44*3ee4fc2aSCody Peter MelloBEGIN {
45*3ee4fc2aSCody Peter Mello	foo()
46*3ee4fc2aSCody Peter Mello}
47*3ee4fc2aSCody Peter Mello
48*3ee4fc2aSCody Peter Mello# ==== The output for "gawk -f x.gawk" (SunOS) ====
49*3ee4fc2aSCody Peter Mello#
50*3ee4fc2aSCody Peter Mello# gawk: x.gawk:4: fatal error: internal error
51