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