Last active
October 31, 2018 16:50
-
-
Save SqrtNegInf/2b0ccf921e2c5b529432555c74ece006 to your computer and use it in GitHub Desktop.
Rakudo segfault, goes away if MVM_SPESH_OSR_DISABLE=1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The error occurs with the call to crc32, from this line in Image::PNG::Portable: | |
$fh.write: bytes String::CRC32::crc32 @td; | |
After removing .race from the calling program, can further localize to this line in routine crc32: | |
$crc +^= 0xFFFFFFFF | |
================================================================================================ | |
This is Rakudo Perl 6 running in the GNU debugger, which often allows the user to generate useful back- | |
traces to debug or report issues in Rakudo, the MoarVM backend or the currently running code. | |
This Rakudo version is 2018.10.29.g.052067.fd.1 built on MoarVM version 2018.10.26.g.318.e.1.ec.55, | |
running on macosx (10.11.6) / darwin (15.6.0) | |
Type `bt full` to generate a backtrace if applicable, type `q` to quit or `help` for help. | |
------------------------------------------------------------------------------------------------ | |
Reading symbols from /Users/dhoekman/.rakudobrew/moar-master/install/bin/moar...(no debugging symbols found)...done. | |
Starting program: /Users/dhoekman/.rakudobrew/moar-master/install/bin/moar --execname=/Users/dhoekman/.rakudobrew/bin/../moar-master/install/bin/perl6-gdb-m --libpath=/Users/dhoekman/.rakudobrew/moar-master/install/share/nqp/lib --libpath=/Users/dhoekman/.rakudobrew/moar-master/install/share/perl6/lib --libpath=/Users/dhoekman/.rakudobrew/moar-master/install/share/perl6/runtime /Users/dhoekman/.rakudobrew/moar-master/install/share/perl6/runtime/perl6.moarvm exp/Kronecker_product_based_fractals | |
[New Thread 0x1217 of process 42087] | |
This type cannot unbox to a native integer: P6opaque, Mu | |
in sub crc32 at /Users/dhoekman/.rakudobrew/moar-master/install/share/perl6/site/sources/B11DB940E55C33C6937C1A1A778565879AE880A0 (String::CRC32) line 51 | |
in sub write-chunk at /Users/dhoekman/.rakudobrew/moar-master/install/share/perl6/site/sources/7941A7DCDF4B308B87530EF4CA5D4019405D3297 (Image::PNG::Portable) line 83 | |
in method write at /Users/dhoekman/.rakudobrew/moar-master/install/share/perl6/site/sources/7941A7DCDF4B308B87530EF4CA5D4019405D3297 (Image::PNG::Portable) line 64 | |
in block <unit> at exp/Kronecker_product_based_fractals line 39 | |
[Inferior 1 (process 42087) exited with code 01] | |
##########################################################################' | |
# simplest version of the program that triggers the bug | |
# note how only the 2nd write (of the same input) triggers the bug | |
# avoid actual segfault (to allow debugging) with MVM_JIT_DISABLE=1 | |
# based on: http://rosettacode.org/wiki/Kronecker_product_based_fractals | |
use Image::PNG::Portable; | |
sub kronecker-product ( @a, @b ) { (@a X @b).map: { (.[0].list X* .[1].list).Array } } | |
sub kronecker-fractal ( @pattern, $order = 4 ) { | |
my @kronecker = @pattern; | |
@kronecker = kronecker-product(@kronecker, @pattern) for ^$order; | |
@kronecker | |
} | |
my @vicsek = ( [0, 1, 0], [1, 1, 1], [0, 1, 0] ); | |
for 'vicsek', @vicsek, 4, | |
'vicsek', @vicsek, 4 | |
-> $name, @shape, $order { | |
my @img = kronecker-fractal( @shape, $order ); | |
my $png = Image::PNG::Portable.new: :width(@img[0].elems), :height(@img.elems); | |
for ^@img[0] X ^@img -> ($x, $y) { | |
$png.set: $x, $y, |( @img[$y;$x] ?? <255 255 32> !! <16 16 16> ); | |
} | |
$png.write: "run/kronecker-{$name}-perl6.png"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment