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

Range operator (" " .. " ") infinite list / out of memory #1890

Closed
p6rt opened this issue Jun 27, 2010 · 5 comments
Closed

Range operator (" " .. " ") infinite list / out of memory #1890

p6rt opened this issue Jun 27, 2010 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Jun 27, 2010

Migrated from rt.perl.org#76226 (status was 'resolved')

Searchable as RT76226$

@p6rt
Copy link
Author

p6rt commented Jun 27, 2010

From js@mysterious.me.uk

Hi

I think I found a bug while playing around with Rakudo. It's the latest
downloaded from git​:

commit 7c83e65fb2cda0ddd85e6abe98b18ee7da4a465f
Author​: Solomon Foster <colomon@​gmail.com>
Date​: Fri Jun 4 16​:06​:32 2010 -0400

  Switch sub version of map to take slurpy values.

This compiler is built with the Parrot Compiler Toolkit, parrot revision
47344.

The problem is simple to reproduce​:

./perl6 -e 'say " " .. " "'

runs out of memory (after a long time). While experimenting I also found
that the following fails (seemingly faster, so I have the output here
too).

./perl6 -e 'say "" .. ""'

Failed allocation of 24445868 bytes
Parrot VM​: PANIC​: Out of mem!
C file src/gc/alloc_memory.c, line 151
Parrot file (not available), line (not available)

We highly suggest you notify the Parrot team if you have not been
working on
Parrot. Use parrotbug (located in parrot's root directory) or send an
e-mail to parrot-dev@​lists.parrot.org.
Include the entire text of this error message and the text of the script
that
generated the error. If you've made any modifications to Parrot, please
describe them as well.

Version : 2.4.0-devel
Configured : Fri Jun 4 11​:48​:39 2010 GMT
Architecture​: i386-linux
JIT Capable : No
Interp Flags​: (no interpreter)
Exceptions : (missing from core)

Dumping Core...
Quit

In perl 5, " " .. " " returns " " as I would expect. And "" .. ""
returns nothingness as I would expect.

I also tested "A" .. "A" and "X" .. " " and they did not blow up.

I've been told on #perl6 that "" .. "" is maybe supposed to return an
infinite list. However people didn't seem so sure about " " .. " ", but
according to my understanding of the discussion, it seems to be trying
to build an infinite list of " ".

I hope this helps.

Cheers
J

@p6rt
Copy link
Author

p6rt commented Jun 28, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S03-operators/range.t

commit 0b4efc616725ff1f53c2747cafa460cd83a4edec
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Mon Jun 28 20​:59​:03 2010 +0000

  [t/spec] test for RT #​76226, all-whitespace range
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31486 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S03-operators/range.t b/t/spec/S03-operators/range.t
index 29ab727..8a36cd6 100644
--- a/t/spec/S03-operators/range.t
+++ b/t/spec/S03-operators/range.t
@@ -2,7 +2,7 @@ use v6;
 
 use Test;
 
-plan 113;
+plan 114;
 
 
 # L<S03/Nonchaining binary precedence/Range object constructor>
@@ -27,6 +27,8 @@ is ~('z'..'Y'), '',    '(..) works on auto-rev uppercase letter .. lowercase let
 is ~('Y'..'_'), 'Y Z', '(..) works on letter .. non-letter (1)';
 is ~('_'..'Y'), '',    '(..) works on auto-rev letter .. non-letter (2)';
 
+is ~(' '..' '), ' ',    'all-whitespace range works';
+
 is ~(3..9-3), "3 4 5 6", "(..) has correct precedence (1)";
 is ~(5..9-5), "",        "(..) has correct precedence (2)";
 is ~(2+1..6), "3 4 5 6", "(..) has correct precedence (3)";

@p6rt
Copy link
Author

p6rt commented Jun 28, 2010

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

@p6rt
Copy link
Author

p6rt commented Jun 28, 2010

From @moritz

This has been fixed already, and the test passes.

@p6rt
Copy link
Author

p6rt commented Jun 28, 2010

@moritz - Status changed from 'open' to 'resolved'

@p6rt p6rt closed this as completed Jun 28, 2010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant