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

recursive "use" causes infinite loop. #375

Closed
p6rt opened this issue Oct 27, 2008 · 5 comments
Closed

recursive "use" causes infinite loop. #375

p6rt opened this issue Oct 27, 2008 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Oct 27, 2008

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

Searchable as RT60160$

@p6rt
Copy link
Author

p6rt commented Oct 27, 2008

From @chrisdolan

The following simple test involves two .pm files that depend on each
other. In revision 32120, this causes an infinite loop. The
attached trivial patch prevents the loop by making Rakudo mark the
modules as loaded before parsing them. This is how Perl5 behaves.

=== File lib/One.pm ===
use v6;
use Two;
=== File lib/Two.pm ===
use v6;
use One;
=== File test.pl ===
use v6;
use One;

% env PERL6LIB=./lib perl6 test.pl

maximum recursion depth exceeded
current instr.​: 'parrot;PGE;Match;new' pc 25 (compilers/pge/PGE/
Match.pir​:54)
called from Sub 'parrot;Perl6;Grammar;pod_comment' pc 20852 (src/
gen_grammar.pir​:981)
called from Sub 'parrot;Perl6;Grammar;unv' pc 20526 (src/
gen_grammar.pir​:850)
called from Sub 'parrot;Perl6;Grammar;ws' pc 19642 (src/
gen_grammar.pir​:487)
called from Sub 'parrot;Perl6;Grammar;MARK_STATEMENT_END' pc 26706
(src/gen_grammar.pir​:3276)
called from Sub 'parrot;Perl6;Grammar;TOP' pc 18888 (src/
gen_grammar.pir​:204)
called from Sub 'parrot;PCT;HLLCompiler;parse' pc 630 (src/PCT/
HLLCompiler.pir​:384)
called from Sub 'parrot;PCT;HLLCompiler;compile' pc 433 (src/PCT/
HLLCompiler.pir​:302)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 834 (src/PCT/
HLLCompiler.pir​:490)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1138 (src/PCT/
HLLCompiler.pir​:627)
called from Sub 'require' pc 13575 (src/gen_builtins.pir​:8446)
called from Sub 'use' pc 13601 (src/gen_builtins.pir​:8459)
called from Sub 'anon' pc 8 (EVAL_74​:4)
called from Sub 'parrot;Perl6;Grammar;Actions;_block555' pc 104287
(src/gen_actions.pir​:1687)
called from Sub 'parrot;Perl6;Grammar;Actions;use_statement' pc
104140 (src/gen_actions.pir​:1639)
called from Sub 'parrot;Perl6;Grammar;use_statement' pc 43456 (src/
gen_grammar.pir​:9625)
called from Sub 'parrot;Perl6;Grammar;statement_control' pc 32015
(src/gen_grammar.pir​:5227)
called from Sub 'parrot;Perl6;Grammar;statement' pc 26968 (src/
gen_grammar.pir​:3386)
called from Sub 'parrot;Perl6;Grammar;statementlist' pc 25021 (src/
gen_grammar.pir​:2618)
called from Sub 'parrot;Perl6;Grammar;statement_block' pc 23060 (src/
gen_grammar.pir​:1846)
called from Sub 'parrot;Perl6;Grammar;TOP' pc 18954 (src/
gen_grammar.pir​:228)
called from Sub 'parrot;PCT;HLLCompiler;parse' pc 630 (src/PCT/
HLLCompiler.pir​:384)
called from Sub 'parrot;PCT;HLLCompiler;compile' pc 433 (src/PCT/
HLLCompiler.pir​:302)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 834 (src/PCT/
HLLCompiler.pir​:490)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1138 (src/PCT/
HLLCompiler.pir​:627)
called from Sub 'require' pc 13575 (src/gen_builtins.pir​:8446)
called from Sub 'use' pc 13601 (src/gen_builtins.pir​:8459)
called from Sub 'anon' pc 8 (EVAL_73​:4)
[ ... 942 lines deleted ... ]
called from Sub 'require' pc 13575 (src/gen_builtins.pir​:8446)
called from Sub 'use' pc 13601 (src/gen_builtins.pir​:8459)
called from Sub 'anon' pc 8 (EVAL_10​:4)
called from Sub 'parrot;Perl6;Grammar;Actions;_block555' pc 104287
(src/gen_actions.pir​:1687)
called from Sub 'parrot;Perl6;Grammar;Actions;use_statement' pc
104140 (src/gen_actions.pir​:1639)
called from Sub 'parrot;Perl6;Grammar;use_statement' pc 43456 (src/
gen_grammar.pir​:9625)
called from Sub 'parrot;Perl6;Grammar;statement_control' pc 32015
(src/gen_grammar.pir​:5227)
called from Sub 'parrot;Perl6;Grammar;statement' pc 26968 (src/
gen_grammar.pir​:3386)
called from Sub 'parrot;Perl6;Grammar;statementlist' pc 25021 (src/
gen_grammar.pir​:2618)
called from Sub 'parrot;Perl6;Grammar;statement_block' pc 23060 (src/
gen_grammar.pir​:1846)
called from Sub 'parrot;Perl6;Grammar;TOP' pc 18954 (src/
gen_grammar.pir​:228)
called from Sub 'parrot;PCT;HLLCompiler;parse' pc 630 (src/PCT/
HLLCompiler.pir​:384)
called from Sub 'parrot;PCT;HLLCompiler;compile' pc 433 (src/PCT/
HLLCompiler.pir​:302)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 834 (src/PCT/
HLLCompiler.pir​:490)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1138 (src/PCT/
HLLCompiler.pir​:627)
called from Sub 'require' pc 13575 (src/gen_builtins.pir​:8446)
called from Sub 'use' pc 13601 (src/gen_builtins.pir​:8459)
called from Sub 'anon' pc 8 (EVAL_9​:4)
called from Sub 'parrot;Perl6;Grammar;Actions;_block555' pc 104287
(src/gen_actions.pir​:1687)
called from Sub 'parrot;Perl6;Grammar;Actions;use_statement' pc
104140 (src/gen_actions.pir​:1639)
called from Sub 'parrot;Perl6;Grammar;use_statement' pc 43456 (src/
gen_grammar.pir​:9625)
called from Sub 'parrot;Perl6;Grammar;statement_control' pc 32015
(src/gen_grammar.pir​:5227)
called from Sub 'parrot;Perl6;Grammar;statement' pc 26968 (src/
gen_grammar.pir​:3386)
called from Sub 'parrot;Perl6;Grammar;statementlist' pc 25021 (src/
gen_grammar.pir​:2618)
called from Sub 'parrot;Perl6;Grammar;statement_block' pc 23060 (src/
gen_grammar.pir​:1846)
called from Sub 'parrot;Perl6;Grammar;TOP' pc 18954 (src/
gen_grammar.pir​:228)
called from Sub 'parrot;PCT;HLLCompiler;parse' pc 630 (src/PCT/
HLLCompiler.pir​:384)
called from Sub 'parrot;PCT;HLLCompiler;compile' pc 433 (src/PCT/
HLLCompiler.pir​:302)
called from Sub 'parrot;PCT;HLLCompiler;eval' pc 834 (src/PCT/
HLLCompiler.pir​:490)
called from Sub 'parrot;PCT;HLLCompiler;evalfiles' pc 1138 (src/PCT/
HLLCompiler.pir​:627)
called from Sub 'parrot;PCT;HLLCompiler;command_line' pc 1317 (src/
PCT/HLLCompiler.pir​:716)
called from Sub 'parrot;Perl6;Compiler;main' pc 17077 (perl6.pir​:179)
perl6(4598) malloc​: *** Deallocation of a pointer not malloced​:
0x44a74a0; This could be a double free(), or free() called with the
middle of an allocated block; Try setting environment variable
MallocHelp to see tools to help debug
perl6(4598) malloc​: *** Deallocation of a pointer not malloced​:
0x4497af0; This could be a double free(), or free() called with the
middle of an allocated block; Try setting environment variable
MallocHelp to see tools to help debug
perl6(4598) malloc​: *** Deallocation of a pointer not malloced​:
0x41a557b; This could be a double free(), or free() called with the
middle of an allocated block; Try setting environment variable
MallocHelp to see tools to help debug

% perl6 -v
This is Rakudo Perl 6, revision 32120 built on parrot 0.8.0-devel
for darwin-thread-multi-2level.

@p6rt
Copy link
Author

p6rt commented Oct 27, 2008

From @chrisdolan

require.patch
Index: src/builtins/eval.pir
===================================================================
--- src/builtins/eval.pir	(revision 32192)
+++ src/builtins/eval.pir	(working copy)
@@ -109,14 +109,15 @@
 
   eval_parrot:
     .local pmc result
+    inc_hash[name] = realfilename
     result = 'evalfile'(realfilename, 'lang'=>'Parrot')
     goto done
 
   eval_perl6:
+    inc_hash[name] = realfilename
     result = 'evalfile'(realfilename, 'lang'=>'Perl6')
 
   done:
-    inc_hash[name] = realfilename
     .return (result)
 .end
 

@p6rt
Copy link
Author

p6rt commented Nov 4, 2008

From @jnthn

On Sun Oct 26 19​:55​:51 2008, chris@​chrisdolan.net wrote​:

The following simple test involves two .pm files that depend on each
other. In revision 32120, this causes an infinite loop. The
attached trivial patch prevents the loop by making Rakudo mark the
modules as loaded before parsing them. This is how Perl5 behaves.

Looks good to me; applied in r32327.

Thanks!

Jonathan

@p6rt
Copy link
Author

p6rt commented Nov 4, 2008

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

@p6rt
Copy link
Author

p6rt commented Nov 4, 2008

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

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