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

Using %() to coerce hash context causes core dump #1774

Closed
p6rt opened this issue Jun 1, 2010 · 11 comments
Closed

Using %() to coerce hash context causes core dump #1774

p6rt opened this issue Jun 1, 2010 · 11 comments
Labels

Comments

@p6rt
Copy link

p6rt commented Jun 1, 2010

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

Searchable as RT75502$

@p6rt
Copy link
Author

p6rt commented Jun 1, 2010

From snarkyboojum@gmail.com

Using %() to coerce hash context causes Rakudo to core dump.

e.g. Using Rakudo @​ 18d99603b2e546702ebe7ff6133b63d3f17e83f8

$ ./perl6 -e '%()'
Segmentation fault (core dumped)

$ ./perl6 -e '%(1,2)'
Segmentation fault (core dumped)

@p6rt
Copy link
Author

p6rt commented Jun 7, 2010

From @cognominal

%() # crashes whatever the way it launched, perl shell, -e, or as a programs

The stack trace indicates an infinite recursion in the GC.
On last git pulls, on a mac running Mac OS 10.6.3

--
cognominal stef

@p6rt
Copy link
Author

p6rt commented Jun 7, 2010

From snarkyboojum@gmail.com

FWIW, this has already been raised as #​75502.

Cheers,
Adrian.

@p6rt
Copy link
Author

p6rt commented Jun 7, 2010

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

@p6rt
Copy link
Author

p6rt commented Aug 3, 2010

From @Timbus

Since I can't seem to find any 'hash' sub anywhere in rakudos source
folder, I assume that .hash is meant to tailcall '&hash' instead. This
seems to fix it.
Not sure why it segfaults, though.

@p6rt
Copy link
Author

p6rt commented Aug 3, 2010

From @Timbus

hashfix.patch
diff --git a/src/builtins/Parcel.pir b/src/builtins/Parcel.pir
index ed2017c..8dd9d9b 100644
--- a/src/builtins/Parcel.pir
+++ b/src/builtins/Parcel.pir
@@ -50,7 +50,7 @@ A Parcel in item context becomes a Seq.
 =cut
 
 .sub 'hash' :method
-    .tailcall 'hash'(self)
+    .tailcall '&hash'(self)
 .end
 
 

@p6rt
Copy link
Author

p6rt commented Aug 3, 2010

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

@p6rt
Copy link
Author

p6rt commented Aug 23, 2010

From @bbkr

Pisa build

$ perl6 -e '%()'
Failed allocation of 3976 bytes
Parrot VM​: PANIC​: Out of mem!
C file src/gc/alloc_memory.c, line 61
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.7.0-devel
Configured : Fri Aug 20 09​:57​:05 2010 GMT
Architecture​: i386-linux
JIT Capable : No
Interp Flags​: (no interpreter)
Exceptions : (missing from core)

Dumping Core...
Quit

@p6rt
Copy link
Author

p6rt commented Aug 23, 2010

From @kyleha

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

commit bcf95590569868d70c6181cc5ebceb0f911234dd
Author​: moritz <moritz@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Mon Aug 23 18​:06​:52 2010 +0000

  [t/spec] tests for %() hash context forcer; also tests RT #​75502
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;32089 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S03-operators/context-forcers.t b/t/spec/S03-operators/context-forcers.t
index c155fd3..7eb2f24 100644
--- a/t/spec/S03-operators/context-forcers.t
+++ b/t/spec/S03-operators/context-forcers.t
@@ -2,7 +2,7 @@ use v6;
 
 use Test;
 
-plan 95;
+plan 100;
 
 #?DOES 1
 sub iis(Mu $a, Mu $b, $descr) {
@@ -198,6 +198,15 @@ sub eval_elsewhere($code){ eval($code) }
     is (@total[8], 888, "total[1] is 100");
 }
 
+{
+    ok %() ~~ Hash, '%() returns a Hash';
+    is +%(), 0, '%() is an empty Hash';
+    my $x = %(a => 3, b => 5);
+    is $x<a>, 3, 'hash constructor worked (1)';
+    is $x<b>, 5, 'hash constructor worked (1)';
+    is $x.keys.join(', '), 'a, b', 'hash constructor produced the right keys';
+}
+
 # the "upto" operator
 # L<S03/Symbolic unary precedence/"prefix:<^>">
 

@p6rt
Copy link
Author

p6rt commented Aug 23, 2010

From @moritz

On Tue Aug 03 06​:32​:34 2010, TiMBuS wrote​:

Since I can't seem to find any 'hash' sub anywhere in rakudos source
folder, I assume that .hash is meant to tailcall '&hash' instead. This
seems to fix it.
Not sure why it segfaults, though.

Thanks for the patch; I've applied it, and it does make the segfault go
away.

Moritz

@p6rt
Copy link
Author

p6rt commented Aug 23, 2010

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

@p6rt p6rt closed this as completed Aug 23, 2010
@p6rt p6rt added the Bug label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant