# New Ticket Created by  Elizabeth Mattijsen 
# Please include the string:  [perl #127748]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=127748 >


==========================
my $a = 14;
while (True) {
    my $z = (2..13).first(-> $x { !($a %% $x) });
    last if (!$z);
    $a += 14
}
say $a
==========================

The above code “verbatim” segfaults on OS X and Linux on HEAD.

Replacing either the (True) by True, or (!$z) by !$z, or adding an additional 
say after the loop, will make the code succeed.


Looking at the output of —target=optimize between (!$z) and !$z, I see only 
this significant difference:

- - QAST::Op(callstatic &prefix:<!>) :BY<modifier_expr W> :statement_id<?> 
:WANTED !
+ - QAST::Op(callstatic &prefix:<!>) :BY<modifier_expr W> :WANTED !

I would have sorta expected that the () would not make a difference for the 
generated code at all, but apparently it does?

Also, disabling spesh or JIT does not seem to make a difference.


In any case, I thought this would be a nice thing for the right people. :-)

Discussion at: http://irclog.perlgeek.de/perl6/2016-03-20#i_12212186


Liz

Reply via email to