On Sat Jan 10 12:19:38 2009, richardh wrote:
> Getting a wierd segmentation fault with the following program (also
> attached).
> 
> I am using rakudo from parrot 35286
> [...]

Try running the script using parrot directly instead of the "perl6"
binary, and let us know if you still see the segfault.  (The perl6
binary is known to have some issues with segfaulting, and is really more
of a Parrot issue than a Rakudo one.)

For the record, on my system the program works as expected with the
"say" line uncommented:

  $ ./parrot perl6.pbc skatersv2.pl
  Use of uninitialized value
  Gold Medal: , Guido Chuffart    94.2
  Gold Medal: Guido Chuffart      94.2
  Use of uninitialized value
  Silver Medal: , Chase Carpenter 91.8
  Silver Medal: Chase Carpenter   91.8
  Use of uninitialized value
  Bronze Medal: , Cecilia Cornejo 91.6
  Bronze Medal: Cecilia Cornejo   91.6
  $

The uninitialized value warnings come from the code:

> my @ranking = %players.sort: { .value };
> for <Gold Silver Bronze> -> $m {
>     given pop @ranking {
>     say "$m Medal: " ~ %players{$_} ~ ', ' ~ $_;
> #    say "$m Medal: $_";
>     };
> };

After sorting %players by .value, @ranking is left as a list of Pair
objects.  Thus "pop @ranking" returns a Pair, and the uninitialized
value comes from using the Pair as a key in %players{$_} .

Let us know if you still see the segmentation fault when run with
"parrot perl6.pbc" instead of the perl6 binary.

Thanks!

Pm


Reply via email to