Blame test/nasty.awk

Packit 575503
#From hankedr@manatee.dms.auburn.edu  Tue Oct 13 22:15:59 1998
Packit 575503
#Return-Path: <hankedr@manatee.dms.auburn.edu>
Packit 575503
#Received: from cssun.mathcs.emory.edu (cssun.mathcs.emory.edu [170.140.150.1])
Packit 575503
#	by dmx.netvision.net.il (8.9.0.Beta5/8.8.6) with ESMTP id PAA03924
Packit 575503
#	for <arobbins@netvision.net.il>; Tue, 13 Oct 1998 15:32:13 +0200 (IST)
Packit 575503
#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 KAA11644 for <arnold@mathcs.emory.edu>; Tue, 13 Oct 1998 10:22:32 -0400 (EDT)
Packit 575503
#Received: from manatee.dms.auburn.edu (manatee.dms.auburn.edu [131.204.53.104])
Packit 575503
#	by mescaline.gnu.org (8.9.1a/8.9.1) with ESMTP id KAA03250
Packit 575503
#	for <arnold@gnu.org>; Tue, 13 Oct 1998 10:25:32 -0400
Packit 575503
#Received: (from hankedr@localhost)
Packit 575503
#	by manatee.dms.auburn.edu (8.9.1a/8.9.1) id JAA13348;
Packit 575503
#	Tue, 13 Oct 1998 09:22:29 -0500 (CDT)
Packit 575503
#Date: Tue, 13 Oct 1998 09:22:29 -0500 (CDT)
Packit 575503
#Message-Id: <199810131422.JAA13348@manatee.dms.auburn.edu>
Packit 575503
#From: Darrel Hankerson <hankedr@dms.auburn.edu>
Packit 575503
#To: arnold@gnu.org
Packit 575503
#In-reply-to: <199810131313.QAA31784@alpha.netvision.net.il> (message from
Packit 575503
#	Aharon Robbins on Tue, 13 Oct 1998 16:10:36 +0200)
Packit 575503
#Subject: Re: full text of bug report?
Packit 575503
#Mime-Version: 1.0
Packit 575503
#Content-Type: text/plain; charset=US-ASCII
Packit 575503
#X-UIDL: bf3fce492dad4ab030c561e7b2f27d0a
Packit 575503
#Status: RO
Packit 575503
#
Packit 575503
#   Do you have the full text of the	a = a "\n" f() 	bug report?
Packit 575503
#   I can't find it.... I'm not sure there really is a bug.
Packit 575503
#
Packit 575503
#Yes, see below.  
Packit 575503
#
Packit 575503
#His example has unnecessary fragments (in particular, the use of
Packit 575503
#gensub is irrelevant).  As I wrote to you earlier, the interesting
Packit 575503
#question for me is:
Packit 575503
#
Packit 575503
#   Is the concatenation result undefined?  If the result is defined or
Packit 575503
#   implementation-dependent, then gawk has a bug.
Packit 575503
#
Packit 575503
#
Packit 575503
#=== Original report =====================================================
Packit 575503
#From: Attila Torcsvari <arcdev@mail.matav.hu>
Packit 575503
#To: "'bug-gnu-utils@prep.ai.mit.edu'" <bug-gnu-utils@gnu.org>
Packit 575503
#Subject: gawk 3.0.3 bug
Packit 575503
#Date: Thu, 17 Sep 1998 18:12:13 +0200
Packit 575503
#MIME-Version: 1.0
Packit 575503
#Content-Transfer-Encoding: 7bit
Packit 575503
#Resent-From: bug-gnu-utils@gnu.org
Packit 575503
#X-Mailing-List: <bug-gnu-utils@gnu.org> archive/latest/3396
Packit 575503
#X-Loop: bug-gnu-utils@gnu.org
Packit 575503
#Precedence: list
Packit 575503
#Resent-Sender: bug-gnu-utils-request@gnu.org
Packit 575503
#Content-Transfer-Encoding: 7bit
Packit 575503
#Content-Type: text/plain; charset="us-ascii"
Packit 575503
#Content-Length: 618
Packit 575503
#
Packit 575503
#Bug-gnuers,
Packit 575503
#please pass it to the responsible.
Packit 575503
#
Packit 575503
#The following generates something interesting:
Packit 575503
#
Packit 575503
BEGIN{
Packit 575503
a="aaaaa"
Packit 575503
a=a a #10
Packit 575503
a=a a #20
Packit 575503
a=a a #40
Packit 575503
a=a a #80
Packit 575503
a=a a #160
Packit 575503
a=a a # i.e. a is long enough
Packit 575503
Packit 575503
a=a"\n"f() # this causes the trouble
Packit 575503
print a # guess the result
Packit 575503
}
Packit 575503
Packit 575503
function f()
Packit 575503
{
Packit 575503
#print "a before: ", a
Packit 575503
#a=gensub("a","123,","g",a) # 'a' will be just a bit longer (4 times, but still should fit: 4*160=640)
Packit 575503
gsub(/a/, "123", a)
Packit 575503
#print "a after: ", a
Packit 575503
return "X"
Packit 575503
}
Packit 575503
#
Packit 575503
#Possible reason:
Packit 575503
#during f the a is modified,
Packit 575503
#it can be even freed, because gensub modifies its size
Packit 575503
#the printout contains trash.
Packit 575503
#
Packit 575503
#Used version: VC compiled WinNT 32 bit Intel.
Packit 575503
#
Packit 575503
#Regards,
Packit 575503
#
Packit 575503
#Attila Torcsvari
Packit 575503
#Arcanum Development
Packit 575503
#