Perl core dumping - possible bug?

A

Ala Qumsieh

Hi all,

The following snippet coredumps in both perl5.6.1 and perl5.8.3 on both
linux and solaris, as well as perl5.8.0 on winXP:

% perl -Mstrict -wle 'map {map {print "x" for 1 .. 5} 1..5} 1..5'

Interestingly, the following coredumps in 5.6.1, but not in 5.8.0 or 5.8.3:

% perl -Mstrict -wle 'map {print "x" for 1 .. 5} 1..5'

Am I doing something wrong, or have I stumbled upon some Perl bug?
Can someone please confirm with the latest stable release 5.8.7?

Thanks,
--Ala
 
A

A. Sinan Unur

The following snippet coredumps in both perl5.6.1 and perl5.8.3 on
both linux and solaris, as well as perl5.8.0 on winXP:

% perl -Mstrict -wle 'map {map {print "x" for 1 .. 5} 1..5} 1..5'

Interestingly, the following coredumps in 5.6.1, but not in 5.8.0 or
5.8.3:

% perl -Mstrict -wle 'map {print "x" for 1 .. 5} 1..5'

Am I doing something wrong, or have I stumbled upon some Perl bug?
Can someone please confirm with the latest stable release 5.8.7?

Confirmed.

D:\Home> perl -v

This is perl, v5.8.7 built for MSWin32-x86-multi-thread
(with 7 registered patches, see perl -V for more detail)
This is on WinXP SP2 AMD64

asu1@recex:~ > perl -v
This is perl, v5.8.7 built for i386-freebsd-64int
This is on FreeBSD 5.4 Athlon.

In both cases, I get a segfault.

Sinan
 
X

xhoster

Ala Qumsieh said:
Hi all,

The following snippet coredumps in both perl5.6.1 and perl5.8.3 on both
linux and solaris, as well as perl5.8.0 on winXP:

% perl -Mstrict -wle 'map {map {print "x" for 1 .. 5} 1..5} 1..5'

Interestingly, the following coredumps in 5.6.1, but not in 5.8.0 or
5.8.3:

% perl -Mstrict -wle 'map {print "x" for 1 .. 5} 1..5'

Am I doing something wrong, or have I stumbled upon some Perl bug?

I'd say both. The desire to do this seems perverse, to me. But it
still shouldn't seg fault.
Can someone please confirm with the latest stable release 5.8.7?

Confirmed on 5.8.7 on Linux.

Xho
 
A

Anno Siegel

I'd say both. The desire to do this seems perverse, to me. But it
still shouldn't seg fault.


Confirmed on 5.8.7 on Linux.

Seen here too, but only with three-deep nesting.

The for loop in a map block seems to be the problem. Map wants to collect
the values of the last statement in that block, but a for loop has no
value. Changing the innermost block to

{print "x" for 1 .. 5; 1}

helps. Of course, things like "sub {}" don't return a value either
and can be called in map. It shouldn't segfault.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top