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