Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matching over 256 items yields wrong results, sometimes #5075

Open
p6rt opened this issue Jan 28, 2016 · 6 comments
Open

Matching over 256 items yields wrong results, sometimes #5075

p6rt opened this issue Jan 28, 2016 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Jan 28, 2016

Migrated from rt.perl.org#127403 (status was 'open')

Searchable as RT127403$

@p6rt
Copy link
Author

p6rt commented Jan 28, 2016

From @labster

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>

@p6rt
Copy link
Author

p6rt commented Jan 28, 2016

From @lizmat

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-archive.perl.org/perl6/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>

@p6rt
Copy link
Author

p6rt commented Jan 28, 2016

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Nov 24, 2016

From @labster

Seems to be fixed in Moar back in August with some spesh changes.

On Thu, 28 Jan 2016 01​:20​:17 -0800, elizabeth wrote​:

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-archive.perl.org/perl6/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>

1 similar comment
@p6rt
Copy link
Author

p6rt commented Nov 24, 2016

From @labster

Seems to be fixed in Moar back in August with some spesh changes.

On Thu, 28 Jan 2016 01​:20​:17 -0800, elizabeth wrote​:

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-archive.perl.org/perl6/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>

@p6rt
Copy link
Author

p6rt commented Mar 1, 2017

From @zoffixznet

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/ {
  }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant