On Sat, 13 May 2017 07:26:05 -0700, c...@zoffix.com wrote: > Before ef29bb9f41aa5d[^1], the +> op special cased large shifts and > large numbers. Now that special-casing was removed, > it works fine in the first few runs, but then starts giving incorrect > results (setting MVM_SPESH_DISABLE fixes the issue). > > I couldn't repro it with *just* the `+>` op, but only in this > combination: > > <Zoffix_> c: ef29bb9f41aa5d sub rotr(uint32 $n, uint32 $b) { $n +> $b > +| $n +< (32 - $b) }; say rotr 1652322944, 18; my $x; for ^1000 { $x = > rotr 1652322944, 18 }; say $x > <committable6> Zoffix_, ¦ef29bb9: «2707165912079927071659114496» > <Zoffix_> c: ef29bb9f41aa5d~1 sub rotr(uint32 $n, uint32 $b) { $n +> > $b +| $n +< (32 - $b) }; say rotr 1652322944, 18; my $x; for ^1000 { > $x = rotr 1652322944, 18 }; say $x > <committable6> Zoffix_, ¦ef29bb9f41aa5d~1: > «2707165912079927071659120799» > > [1] https://github.com/rakudo/rakudo/commit/ef29bb9f41aa5d
I added a temporary workaround[^1] as well as tests[^2] to cover this bug. The issue still needs proper addressing as the workaround merely prevents inlining of +< and +> ops [1] https://github.com/rakudo/rakudo/commit/2f22b701d4cf44fa43500edcc3450718fa7fd468 [2] https://github.com/perl6/roast/commit/c1d62112f3