1 #From vp@dmat.uevora.pt Thu Jun 18 09:10 EDT 1998
2 #Received: from mescaline.gnu.org (we-refuse-to-spy-on-our-users@mescaline.gnu.org [158.121.106.21]) by cssun.mathcs.emory.edu (8.7.5/8.6.9-940818.01cssun) with ESMTP id JAA23649 for <arnold@mathcs.emory.edu>; Thu, 18 Jun 1998 09:10:54 -0400 (EDT)
3 #Received: from khromeleque.dmat.uevora.pt by mescaline.gnu.org (8.8.5/8.6.12GNU) with ESMTP id JAA21732 for <arnold@gnu.ai.mit.edu>; Thu, 18 Jun 1998 09:11:19 -0400
4 #Received: from khromeleque.dmat.uevora.pt (vp@localhost [127.0.0.1])
5 # by khromeleque.dmat.uevora.pt (8.8.8/8.8.8/Debian/GNU) with ESMTP id OAA11817
6 # for <arnold@gnu.ai.mit.edu>; Thu, 18 Jun 1998 14:13:57 +0100
7 #Message-Id: <199806181313.OAA11817@khromeleque.dmat.uevora.pt>
9 #Subject: concatenation bug in gawk 3.0.3
10 #Date: Thu, 18 Jun 1998 14:13:57 +0200
11 #From: Vasco Pedro <vp@dmat.uevora.pt>
18 #The gawk program '{print NR " " 10/NR}' will print:
27 #instead of the correct:
36 #You'll notice, on the incorrect output, that the first column is
37 #the first digit of the second.
39 #I think the problem comes from the way builtin variables are handled.
40 #Since the items to be concatenated are processed in reverse order and
41 #the return value of tree_eval(``NR'') is a pointer to the value part
42 #of `NR_node', the `unref()' of `NR_node' due to its second occurrence
43 #will leave a dangling pointer in `strlist'. The reason that it doesn't
44 #reuse the freed space with objects of the same type. (Using Electric
45 #Fence with EF_PROTECT_FREE set confirms that freed space is being
48 #The enclosed patch (hack would be a better word to describe it) is
49 #all I could come up with. With it installed, things seem to work ok,
50 #but I doubt this is the correct way to do it. (If I treated the
51 #case for `Node_field_spec' as the I did others, `make check' would
52 #fail in several places.)
57 #*** eval.c~ Tue May 6 21:39:55 1997
58 #--- eval.c Thu Jun 18 13:39:25 1998
61 # return func_call(tree->rnode, tree->lnode);
63 # /* unary operations */
67 # case Node_FIELDWIDTHS:
70 #- case Node_field_spec:
71 # case Node_subscript:
72 # case Node_IGNORECASE:
75 # return func_call(tree->rnode, tree->lnode);
77 # /* unary operations */
78 #+ case Node_field_spec:
79 #+ lhs = get_lhs(tree, (Func_ptr *) NULL);
85 # case Node_FIELDWIDTHS:
88 # case Node_subscript:
89 # case Node_IGNORECASE:
95 # lhs = get_lhs(tree, (Func_ptr *) NULL);
98 # case Node_var_array:
99 # fatal("attempt to use array `%s' in a scalar context",
103 # lhs = get_lhs(tree, (Func_ptr *) NULL);
104 #! r = dupnode(*lhs);
108 # case Node_var_array:
109 # fatal("attempt to use array `%s' in a scalar context",
111 { print NR " " 10/NR }