dwork@pepsi.amd.com (Jeff Dwork) (03/22/90)
My sun3 dumps core on the following perl script. It works ok on a sun4.
OS is 4.0.3.
My heartfelt thanks to Larry for creating perl and to all you folks on the
net that have helped me learn it.
% perl bug.pl
before subx
4
returning from subx
Bus error (core dumped)
% cat bug.pl
#!/usr/local/bin/perl
sub subx {
local(@alx,@spalx,$x); # only @alx needs to be local for bug
@alx = (1,2,3,4,5,6,7,8);
@spalx = splice(@alx,0,5);
# the following two lines could be just: print "$#spalx";
# the double quotes are essential for bug
# print $x; and print $#spalx; work ok
$x = $#spalx;
print "$x";
print "\n";
print "returning from subx\n";
}
print "before subx\n";
&subx;
print "returned ok\n";
1;
% perl -v
$Header: perly.c,v 3.0.1.4 90/02/28 18:06:41 lwall Locked $
Patch level: 14
Copyright (c) 1989, Larry Wall
Perl may be copied only under the terms of the GNU General Public License,
a copy of which can be found with the Perl 3.0 distribution kit.
----
Jeff Dwork | 408-749-2356 | dwork@AMD.COM
Advanced Micro Devices, M/S 45 |---------------------------------------
PO Box 3453 | The above opionions are mine,
Sunnyvale, Ca 94088 | not AMD's.
Jeff Dwork | 408-749-2356 | dwork@AMD.COM
Advanced Micro Devices, M/S 45 |---------------------------------------
PO Box 3453 | The above opionions are mine,
Sunnyvale, Ca 94088 | not AMD's.
dwork@pepsi.amd.com (Jeff Dwork) (03/23/90)
In article <29584@amdcad.AMD.COM> dwork@pepsi.AMD.COM (Jeff Dwork) writes: >My sun3 dumps core on the following perl script. It works ok on a sun4. >OS is 4.0.3. This also fails on Patchlevel 15. % cat bug.pl #!/usr/local/bin/perl sub subx { local(@alx,@spalx,$x); # only @alx needs to be local for bug @alx = (1,2,3,4,5,6,7,8); @spalx = splice(@alx,0,5); $x = $#spalx; print "$x"; print "\n"; print "returning from subx\n"; } print "before subx\n"; &subx; print "returned ok\n"; 1; Jeff Dwork | 408-749-2356 | dwork@AMD.COM Advanced Micro Devices, M/S 45 |--------------------------------------- PO Box 3453 | The above opionions are mine, Sunnyvale, Ca 94088 | not AMD's.
lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (03/23/90)
In article <29584@amdcad.AMD.COM> dwork@pepsi.AMD.COM (Jeff Dwork) writes:
: My sun3 dumps core on the following perl script.
Fixed, thanks. Forgot to zero some pointers that were copied elsewhere,
so got a duplicate free when the local() freed it. Oops, and all that.
Larry