Merge from vendor branch OPENSSH:
[dragonfly.git] / contrib / awk / test / arynocls.awk
1 #To: bug-gnu-utils@gnu.org
2 #From: Kristján Jónasson <kristjan@decode.is>
3 #Subject: Gawk bug
4 #Cc: arnold@gnu.org
5 #
6 #Hi!
7 #
8 #The following seems to be a bug in gawk. I have tried as I could to
9 #minimize the bug-causing program, so of course it does not seem to do
10 #anything useful in its present form. The error message received is:
11 #
12 #gawk: test.awk:15: fatal error: internal error
13 #Aborted
14 #
15 #Note that there is an attached file that the program reads, called "a". I
16 #played with the program a fair bit and my feeling is that the error is
17 #related with the delete statement, and not the reading of the file and the
18 #close statement. At one point I was able to remove the file reading and
19 #still obtain the error. If, for example, I remove the close statement and
20 #make two copies of the file instead, (reading one copy in sub1 and the
21 #other in sub2), the error still occurs.
22 #
23 #The operating system is Red Hat Linux, version 6.0, the gawk is version
24 #3.0.4, and the gawk was obtained from an rpm file gawk-3.0.4-1.i386.rpm.
25 #
26 #The program is:
27 #
28
29 # Wed Mar  8 13:41:34 IST 2000
30 # ADR: modified to use INPUT, so can set it from command line.
31 #      When run, no output is produced, but it shouldn't core
32 #      dump, either.
33 #
34 # The program bug is to not close the file in sub2.
35
36 function sub1(x) {
37 # while (getline < "a" == 1) i++
38   while (getline < INPUT == 1) i++
39 # close("a")
40   close(INPUT)
41 }
42
43 function sub2(x) {
44   i=0
45   delete y
46 # while (getline < "a" == 1) z[++i] = $1
47   while (getline < INPUT == 1) z[++i] = $1
48   for(i in z) y[i] = x[i] + z[i]
49 }
50
51 function sub3(x, y, z) {
52   sub2(x)
53   for(i=1; i<=4; i++) z[i] = y[i]
54 }
55
56 BEGIN {
57   sub1(x)
58   sub2(x)
59   sub3(x, y, z)
60 }
61 #
62 #And the data file is:
63 #
64 # 32.440    3.830    3.383700000000000    10.08    298  865
65 # 32.440    3.830    3.383700000000000    10.08    298  865
66 # 32.440    3.830    3.383700000000000    10.08    298  865
67 # 32.440    3.830    3.383700000000000    10.08    298  865
68 # 32.440    3.830    3.383700000000000    10.08    298  865
69 # 32.440    3.830    3.383700000000000    10.08    298  865
70 # 32.440    3.830    3.383700000000000    10.08    298  865
71 # 32.440    3.830    3.383700000000000    10.08    298  865
72 # 32.440    3.830    3.383700000000000    10.08    298  865
73 # 32.440    3.830    3.383700000000000    10.08    298  865
74 # 32.440    3.830    3.383700000000000    10.08    298  865
75 # 32.440    3.830    3.383700000000000    10.08    298  865
76 # 32.440    3.830    3.383700000000000    10.08    298  865
77 # 32.440    3.830    3.383700000000000    10.08    298  865
78 # 32.440    3.830    3.383700000000000    10.08    298  865
79 # 32.440    3.830    3.383700000000000    10.08    298  865
80 # 32.440    3.830    3.383700000000000    10.08    298  865
81 # 32.440    3.830    3.383700000000000    10.08    298  865
82 # 32.440    3.830    3.383700000000000    10.08    298  865
83 # 32.440    3.830    3.383700000000000    10.08    298  865
84 # 32.440    3.830    3.383700000000000    10.08    298  865
85 # 32.440    3.830    3.383700000000000    10.08    298  865
86 # 32.440    3.830    3.383700000000000    10.08    298  865
87 # 32.440    3.830    3.383700000000000    10.08    298  865
88 # 32.440    3.830    3.383700000000000    10.08    298  865
89 # 32.440    3.830    3.383700000000000    10.08    298  865
90 # 32.440    3.830    3.383700000000000    10.08    298  865
91 # 32.440    3.830    3.383700000000000    10.08    298  865
92 # 32.440    3.830    3.383700000000000    10.08    298  865
93 # 32.440    3.830    3.383700000000000    10.08    298  865
94 #
95 #