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

Null PMC access when calling 'callsame' directly from a sub in Rakudo #1310

Closed
p6rt opened this issue Sep 23, 2009 · 6 comments
Closed

Null PMC access when calling 'callsame' directly from a sub in Rakudo #1310

p6rt opened this issue Sep 23, 2009 · 6 comments
Labels
Bug LHF Low-hanging fruit, easy to resolve testneeded

Comments

@p6rt
Copy link

p6rt commented Sep 23, 2009

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

Searchable as RT69314$

@p6rt
Copy link
Author

p6rt commented Sep 23, 2009

From @masak

<masak> rakudo​: sub foo($n) { say $n; if $n { callsame($n-1) } }; foo(1)
<p6eval> rakudo 0eaf62​: OUTPUT«1â�¤Null PMC access in clone()â�¤in sub foo [...]
* masak submits rakudobug

Hm, maybe I should have used 'callwith' in that piece of code?

Anyway, the bug manifests itself for <call next> X~ <same with>.

@p6rt
Copy link
Author

p6rt commented Jun 27, 2010

From @kyleha

This is an automatically generated mail to inform you that tests are now available in t/spec/S06-advanced_subroutine_features/callsame.t

commit d19774bc271975862491aee6427f9e8d59532716
Author​: radus <radus@​c213334d-75ef-0310-aa23-eaa082d1ae64>
Date​: Sun Jun 27 08​:03​:52 2010 +0000

  [t/spec] Added test for RT69314 - Null PMC access when calling 'callsame' directly from a sub in Rakudo.
 
  git-svn-id​: http://svn.pugscode.org/pugs@&#8203;31473 c213334d-75ef-0310-aa23-eaa082d1ae64

Inline Patch
diff --git a/t/spec/S06-advanced_subroutine_features/callsame.t b/t/spec/S06-advanced_subroutine_features/callsame.t
index d9062ca..65b6108 100644
--- a/t/spec/S06-advanced_subroutine_features/callsame.t
+++ b/t/spec/S06-advanced_subroutine_features/callsame.t
@@ -16,6 +16,20 @@ plan *;
     is @called, <Int Num>, 'multi with "callsame" worked';
 }
 
+# RT 69314
+
+{
+    sub rt69314($n) { 
+        if $n { 
+            callsame($n-1);
+        }
+    }; 
+    
+    #?rakudo todo 'Calling callsame directly from a sub'
+    lives_ok {rt69314(1)}, 'Calling callsame directly from a sub works';
+
+}
+
 done_testing;
 
 # vim: ft=perl6

@p6rt
Copy link
Author

p6rt commented Jun 27, 2010

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

@p6rt
Copy link
Author

p6rt commented Sep 14, 2011

From @jnthn

On Wed Sep 23 03​:16​:28 2009, masak wrote​:

<masak> rakudo​: sub foo($n) { say $n; if $n { callsame($n-1) } }; foo(1)
<p6eval> rakudo 0eaf62​: OUTPUT«1â�¤Null PMC access in clone()â�¤in sub foo
[...]
* masak submits rakudobug

Hm, maybe I should have used 'callwith' in that piece of code?

Anyway, the bug manifests itself for <call next> X~ <same with>.

Now​:

sub foo($n) { say $n; if $n { callsame($n-1) } }; foo(1)
1
Too many positional parameters passed; got 1 but expected 0

Which is right - callsame takes no arguments. And if you just do
callsame()...

sub foo($n) { say $n; if $n { callsame() } }; foo(1)
1
No dispatcher in scope

Which I think is also right. Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Sep 14, 2011

From @tadzik

Test fixed in
Raku/roast@328f005ffe, closable.

@p6rt
Copy link
Author

p6rt commented Sep 14, 2011

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

@p6rt p6rt closed this as completed Sep 14, 2011
@p6rt p6rt added Bug LHF Low-hanging fruit, easy to resolve testneeded labels Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug LHF Low-hanging fruit, easy to resolve testneeded
Projects
None yet
Development

No branches or pull requests

1 participant