Confirmed on macOS. Running with MVM_SPESH_DISABLE=1 does not prevent the segv.
Running with —optimize=0 and —optimize=1 *does* prevent the issue. —optimize=2 and higher shows the problem. Running with “use trace” shows a *lot* of output: the last lines shown are: 12 (/Users/liz/Github/rakudo.moar/1 line 13) @mat[$r; $c] = $val 13 (/Users/liz/Github/rakudo.moar/1 line 13) $r 14 (/Users/liz/Github/rakudo.moar/1 line 13) $c So it looks like evaluating $c does it? Feels like some kind of memory corruption to me. > On 20 Dec 2016, at 16:16, Will Coleda via RT <perl6-bugs-follo...@perl.org> > wrote: > > Attaching gistfile to ticket > > -- > Will "Coke" Coleda > use v6; > my $size = 3001; > my int @mat[$size; $size]; > > init-array(0, $size - 1, $size * $size); > say 'done'; > sub init-array($r, $c, $val) { > @mat[$r; $c] = $val; > if $c - 1 >= 0 > { # left > init-array($r, $c - 1, $val - 1); > } > elsif $r + 1 < $size > { # down > init-array($r + 1, $c, $val - 1); > } > }