Mailing List Archive

Re: I can cause perl 5.001m to coredump consistently
[.courtesy cc of this posting sent to cited author via email]

Yes, this is a bug or two. I've forwarded it to perlbug@perl.com
for eventual inclusion in http://www.perl.com/perl/bugs/

1) It does cause a core dump.
2) The @_ variable isn't mentioned in perlvar
3) Somewhere it's been written that mucking with @_ is a bad
idea, but I can't find the reference.

--tom

In comp.lang.perl.misc, jpn@genrad.com (John P. Nelson) writes:
:The following script consistantly causes perl5.001m to dump core on a
:variety of platforms. The exact behavior is a little different
:on different platforms, though. If the script works, it should print
:10 lines and then exit: it seems to die consistantly after printing
:3 lines.
:
:#! /usr/bin/perl
:
:for (1..10) {
: print "Trial $_\n";
: &foo("a", "b", "c");
:}
:
:sub foo {
: local(@array) = @_;
: local(@_);
:
: @_ = @array;
:}
--
Tom Christiansen Perl Consultant, Gamer, Hiker tchrist@mox.perl.com
The notion of a "record" is an obsolete remnant of the days of the
80-column card.
--Dennis M. Ritchie
Re: I can cause perl 5.001m to coredump consistently [ In reply to ]
On Thu, 07 Sep 1995 10:59:16 MDT, Tom Christiansen wrote:
>
>Yes, this is a bug or two. I've forwarded it to perlbug@perl.com
>for eventual inclusion in http://www.perl.com/perl/bugs/
>
>1) It does cause a core dump.
>2) The @_ variable isn't mentioned in perlvar
>3) Somewhere it's been written that mucking with @_ is a bad
> idea, but I can't find the reference.
>
>--tom
>
>In comp.lang.perl.misc, jpn@genrad.com (John P. Nelson) writes:
>:#! /usr/bin/perl
>:
>:for (1..10) {
>: print "Trial $_\n";
>: &foo("a", "b", "c");
>:}
>:
>:sub foo {
>: local(@array) = @_;
>: local(@_);
>:
>: @_ = @array;
>:}
>

It seems to spell even more trouble with this:

for (1..10) { print "Trial $_\n"; &foo('a', 'b', 'c') }
sub foo { local(@_) = ('p', 'q', 'r'); }
__END__
Trial 1
Trial 2
Trial 3
Bad free() ignored at - line 1.
Trial 4
Bad free() ignored at - line 1.
Trial 5
Attempt to free unreferenced scalar at - line 1.
Trial 6
Bad free() ignored at - line 1.
Trial 7
Corrupt malloc ptr 0xe6eb4 at 0xf0190
Bad free() ignored at - line 1.
Trial 8
Attempt to free unreferenced scalar at - line 1.
Trial 9
Segmentation fault

The problem seems to emanate from freeing a pointer to a compile-time
constant, apparently.

[...]
Trial 4
(-:1) next statement
(-:1) pushmark
(-:1) constant item((FREED)) <------- EEEEEK!
(-:1) constant item(PVIV("b"))
(-:1) constant item(PVIV("c"))
[...]

- Sarathy.
gsar@engin.umich.edu