Skip Menu |
Report information
Id: 127403
Status: open
Priority: 0/
Queue: perl6

Owner: Nobody
Requestors: labster <bslaabs [at] gmail.com>
Cc:
AdminCc:

Severity: (no value)
Tag: testneeded
Platform: (no value)
Patch Status: (no value)
VM: Moar



CC: William Lewis <wlewis [...] ucdavis.edu>
To: rakudobug [...] perl.org
From: Brent Laabs <bslaabs [...] gmail.com>
Subject: [BUG] [wierd] Matching over 256 items yields wrong results, sometimes
Date: Thu, 28 Jan 2016 01:06:43 -0800
Download (untitled) / with headers
text/plain 2.7k
Reported to me by wlewis++ (William Lewis), this took quite a bit of golfing.  Works on 6.c all the way up to current Rakudo 86a90b (but only tested moar).

Some silent failures, some wrong error messages, occasionally correct.  Tons of fun, altogether.  Because of the magic number around 256, I suspect the optimizer but didn't test that either.


brent@ragnar ~/Downloads> cat golf.pl
my $errors = 3;
my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors);

for @stuff -> $line {
    unless $line ~~ m/1/ {
        say "seen: $line" if $line.index("2");
    }
    if $line ~~ m/9/ {
    }
}
brent@ragnar ~/Downloads> perl6 golf.pl
seen: 12
seen: 12
seen: 12
brent@ragnar ~/Downloads> cat golf.pl
my $errors = 5;        # number of errors is configurable!
my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors);

for @stuff -> $line {
    unless $line ~~ m/1/ {
        say "seen: $line" if $line.index("2");
    }
    if $line ~~ m/9/ {
    }
}
brent@ragnar ~/Downloads> perl6 golf.pl
seen: 12
seen: 12
seen: 12
seen: 12
seen: 12
brent@ragnar ~/Downloads> perl6 golf.pl
Invocant requires a type object of type Match, but an object instance was passed.  Did you forget a 'multi'?
  in block <unit> at golf.pl line 4

brent@ragnar ~/Downloads> cat golf.pl
my $errors = 3;
my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors);

for @stuff -> $line {
    unless $line ~~ m/1/ {
        say "seen: $line" if $line.index("2");
    }
    if $line ~~ /9/ {            #lose the m in m//
    }
}
brent@ragnar ~/Downloads> perl6 golf.pl
Invocant requires a type object of type Match, but an object instance was passed.  Did you forget a 'multi'?
  in block <unit> at golf.pl line 4

brent@ragnar ~/Downloads> perl6 golf.pl
seen: 12
seen: 12
seen: 12
brent@ragnar ~/Downloads> cat golf.pl
my $errors = 3;
my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors);

for @stuff -> $line {
    unless $line ~~ /1/ {      #  works if you lose this m
        say "seen: $line" if $line.index("2");
    }
    if $line ~~ m/9/ {
    }
}
brent@ragnar ~/Downloads> perl6 golf.pl
brent@ragnar ~/Downloads> cat golf.pl
my $errors = 3;
my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors);

for @stuff -> $line {
    unless $line ~~ m/1/ {
        say "seen: $line" if $line.index("2");
    }          # take out the if block
}
brent@ragnar ~/Downloads> perl6 golf.pl
Invocant requires a type object of type Match, but an object instance was passed.  Did you forget a 'multi'?
  in block <unit> at golf.pl line 4

brent@ragnar ~/Downloads> cat golf.pl
my $errors = 3;
my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors);

for @stuff -> $line {
    unless $line ~~ /1/ {   # take out the m again with...
        say "seen: $line" if $line.index("2");
    }        # take out the if block
}
brent@ragnar ~/Downloads> perl6 golf.pl
brent@ragnar ~/Downloads>
From: Elizabeth Mattijsen <liz [...] dijkmat.nl>
To: "Brent Laabs (via RT)" <perl6-bugs-followup [...] perl.org>
Date: Thu, 28 Jan 2016 10:19:29 +0100
Subject: Re: [perl #127403] [BUG] [wierd] Matching over 256 items yields wrong results, sometimes
Download (untitled) / with headers
text/plain 3.3k
These problems appear to go away with MVM_SPESH_DISABLE=1 . They stick around with MVM_JIT_DISABLE=1. Liz ================= Show quoted text
> On 28 Jan 2016, at 10:07, Brent Laabs (via RT) <perl6-bugs-followup@perl.org> wrote: > > # New Ticket Created by Brent Laabs > # Please include the string: [perl #127403] > # in the subject line of all future correspondence about this issue. > # <URL: https://rt.perl.org/Ticket/Display.html?id=127403 > > > > Reported to me by wlewis++ (William Lewis), this took quite a bit of > golfing. Works on 6.c all the way up to current Rakudo 86a90b (but only > tested moar). > > Some silent failures, some wrong error messages, occasionally correct. > Tons of fun, altogether. Because of the magic number around 256, I suspect > the optimizer but didn't test that either. > > > brent@ragnar ~/Downloads> cat golf.pl > my $errors = 3; > my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); > > for @stuff -> $line { > unless $line ~~ m/1/ { > say "seen: $line" if $line.index("2"); > } > if $line ~~ m/9/ { > } > } > brent@ragnar ~/Downloads> perl6 golf.pl > seen: 12 > seen: 12 > seen: 12 > brent@ragnar ~/Downloads> cat golf.pl > my $errors = 5; # number of errors is configurable! > my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); > > for @stuff -> $line { > unless $line ~~ m/1/ { > say "seen: $line" if $line.index("2"); > } > if $line ~~ m/9/ { > } > } > brent@ragnar ~/Downloads> perl6 golf.pl > seen: 12 > seen: 12 > seen: 12 > seen: 12 > seen: 12 > brent@ragnar ~/Downloads> perl6 golf.pl > Invocant requires a type object of type Match, but an object instance was > passed. Did you forget a 'multi'? > in block <unit> at golf.pl line 4 > > brent@ragnar ~/Downloads> cat golf.pl > my $errors = 3; > my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); > > for @stuff -> $line { > unless $line ~~ m/1/ { > say "seen: $line" if $line.index("2"); > } > if $line ~~ /9/ { #lose the m in m// > } > } > brent@ragnar ~/Downloads> perl6 golf.pl > Invocant requires a type object of type Match, but an object instance was > passed. Did you forget a 'multi'? > in block <unit> at golf.pl line 4 > > brent@ragnar ~/Downloads> perl6 golf.pl > seen: 12 > seen: 12 > seen: 12 > brent@ragnar ~/Downloads> cat golf.pl > my $errors = 3; > my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); > > for @stuff -> $line { > unless $line ~~ /1/ { # works if you lose this m > say "seen: $line" if $line.index("2"); > } > if $line ~~ m/9/ { > } > } > brent@ragnar ~/Downloads> perl6 golf.pl > brent@ragnar ~/Downloads> cat golf.pl > my $errors = 3; > my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); > > for @stuff -> $line { > unless $line ~~ m/1/ { > say "seen: $line" if $line.index("2"); > } # take out the if block > } > brent@ragnar ~/Downloads> perl6 golf.pl > Invocant requires a type object of type Match, but an object instance was > passed. Did you forget a 'multi'? > in block <unit> at golf.pl line 4 > > brent@ragnar ~/Downloads> cat golf.pl > my $errors = 3; > my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); > > for @stuff -> $line { > unless $line ~~ /1/ { # take out the m again with... > say "seen: $line" if $line.index("2"); > } # take out the if block > } > brent@ragnar ~/Downloads> perl6 golf.pl > brent@ragnar ~/Downloads>
RT-Send-CC: liz [...] dijkmat.nl, wlewis [...] ucdavis.edu
Download (untitled) / with headers
text/plain 3.7k
Seems to be fixed in Moar back in August with some spesh changes. On Thu, 28 Jan 2016 01:20:17 -0800, elizabeth wrote: Show quoted text
> These problems appear to go away with MVM_SPESH_DISABLE=1 . They > stick around with MVM_JIT_DISABLE=1. > > > Liz > =================
> > On 28 Jan 2016, at 10:07, Brent Laabs (via RT) <perl6-bugs- > > followup@perl.org> wrote: > > > > # New Ticket Created by Brent Laabs > > # Please include the string: [perl #127403] > > # in the subject line of all future correspondence about this issue. > > # <URL: https://rt.perl.org/Ticket/Display.html?id=127403 > > > > > > > Reported to me by wlewis++ (William Lewis), this took quite a bit of > > golfing. Works on 6.c all the way up to current Rakudo 86a90b (but > > only > > tested moar). > > > > Some silent failures, some wrong error messages, occasionally > > correct. > > Tons of fun, altogether. Because of the magic number around 256, I > > suspect > > the optimizer but didn't test that either. > > > > > > brent@ragnar ~/Downloads> cat golf.pl > > my $errors = 3; > > my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); > > > > for @stuff -> $line { > > unless $line ~~ m/1/ { > > say "seen: $line" if $line.index("2"); > > } > > if $line ~~ m/9/ { > > } > > } > > brent@ragnar ~/Downloads> perl6 golf.pl > > seen: 12 > > seen: 12 > > seen: 12 > > brent@ragnar ~/Downloads> cat golf.pl > > my $errors = 5; # number of errors is configurable! > > my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); > > > > for @stuff -> $line { > > unless $line ~~ m/1/ { > > say "seen: $line" if $line.index("2"); > > } > > if $line ~~ m/9/ { > > } > > } > > brent@ragnar ~/Downloads> perl6 golf.pl > > seen: 12 > > seen: 12 > > seen: 12 > > seen: 12 > > seen: 12 > > brent@ragnar ~/Downloads> perl6 golf.pl > > Invocant requires a type object of type Match, but an object instance > > was > > passed. Did you forget a 'multi'? > > in block <unit> at golf.pl line 4 > > > > brent@ragnar ~/Downloads> cat golf.pl > > my $errors = 3; > > my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); > > > > for @stuff -> $line { > > unless $line ~~ m/1/ { > > say "seen: $line" if $line.index("2"); > > } > > if $line ~~ /9/ { #lose the m in m// > > } > > } > > brent@ragnar ~/Downloads> perl6 golf.pl > > Invocant requires a type object of type Match, but an object instance > > was > > passed. Did you forget a 'multi'? > > in block <unit> at golf.pl line 4 > > > > brent@ragnar ~/Downloads> perl6 golf.pl > > seen: 12 > > seen: 12 > > seen: 12 > > brent@ragnar ~/Downloads> cat golf.pl > > my $errors = 3; > > my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); > > > > for @stuff -> $line { > > unless $line ~~ /1/ { # works if you lose this m > > say "seen: $line" if $line.index("2"); > > } > > if $line ~~ m/9/ { > > } > > } > > brent@ragnar ~/Downloads> perl6 golf.pl > > brent@ragnar ~/Downloads> cat golf.pl > > my $errors = 3; > > my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); > > > > for @stuff -> $line { > > unless $line ~~ m/1/ { > > say "seen: $line" if $line.index("2"); > > } # take out the if block > > } > > brent@ragnar ~/Downloads> perl6 golf.pl > > Invocant requires a type object of type Match, but an object instance > > was > > passed. Did you forget a 'multi'? > > in block <unit> at golf.pl line 4 > > > > brent@ragnar ~/Downloads> cat golf.pl > > my $errors = 3; > > my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); > > > > for @stuff -> $line { > > unless $line ~~ /1/ { # take out the m again with... > > say "seen: $line" if $line.index("2"); > > } # take out the if block > > } > > brent@ragnar ~/Downloads> perl6 golf.pl > > brent@ragnar ~/Downloads>
RT-Send-CC: perl6-compiler [...] perl.org
Download (untitled) / with headers
text/plain 758b
I went to write a test for this, but can't repoduce the issue. I tried a handful of releases with the IRC bot, then built 2016.01 release and the mentioned 86a90be commit, but none of them fail. Perhaps this is an OSX-only issue? Could someone with OSX try reproing it on 86a90be commit and if the issue is there, would you write a test to cover the bug? This is the script I was using: cpan@perlbuild2/tmp/tmp.uhEtludGhZ ((detached from 86a90be))$ cat foo.p6 my $errors = 5; # number of errors is configurable! my @stuff = flat ("abc" xx 255) Z ("12" xx 128+$errors); for @stuff -> $line { unless $line ~~ m/1/ { say "seen: $line" if $line.index("2"); } if $line ~~ m/9/ { } }


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org