1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
Article 20341 of comp.lang.perl:
Path: netlabs!news.cerf.net!mvb.saic.com!MathWorks.Com!news.kei.com!hookup!swrinde!gatech!taco.cc.ncsu.edu!taco.cc.ncsu.edu!setzer
From: setzer@math.ncsu.edu (William Setzer)
Newsgroups: comp.lang.perl
Subject: perl5a6 bug: sort sub @ary
Date: 30 Mar 94 13:49:20
Organization: The Chebychev Church of Probability
Lines: 23
Distribution: world
Message-ID: <SETZER.94Mar30134920@math.math.ncsu.edu>
NNTP-Posting-Host: math.ncsu.edu
Ok, here's a weird one. Using the precompiled perl5a6 binary for the
sun, the following dumps core:
----
@S = (0, 1, 2, 3);
for ("A", "D", "b", "c") { $foo{$i++} = $_; }
# for (sort { lc($foo{$a}) cmp lc($foo{$b}) } @S) { print $foo{$_}, "\n"; }
for (sort Alpha @S) { print $foo{$_}, "\n"; }
sub Alpha { lc($foo{$a}) cmp lc($foo{$b}); }
----
[Output]
Segmentation fault (core dumped)
----
However, if you comment out the "sort Alpha" and uncomment the "sort
{lc(...) cmp lc(...) }" line, everything works as expected. Also note
that if you uncomment both "sort"s, everything also works as expected.
Do-do-do-do [twilight zone music :-].
William
PS: Does anyone actually care about these bug reports? I thought I
remember Larry saying that he preferred them in c.l.p., but it
wouldn't be the first time my memory has fritzed.
|