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

Rakudo explodes if you run (;) #5116

Closed
p6rt opened this issue Feb 5, 2016 · 5 comments
Closed

Rakudo explodes if you run (;) #5116

p6rt opened this issue Feb 5, 2016 · 5 comments
Labels
Bug

Comments

@p6rt
Copy link

@p6rt p6rt commented Feb 5, 2016

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

Searchable as RT127473$

@p6rt
Copy link
Author

@p6rt p6rt commented Feb 5, 2016

From @AlexDaniel

But let's start with something less impressive.

Code​:
say [;0]

Result​:
Non ast passed to WANTED​: BOOTInt
Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Weird node in analyze​: BOOTInt
===SORRY!===
Unknown QAST node type BOOTInt

Woah! Ok, let's try this.

Code​:
[;]

Result​:
Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Weird node in analyze​: BOOTInt
===SORRY!===
Unknown QAST node type BOOTInt

Okay, that's a bit less impressive. Let's try with ()

Code​:
(;)

Result​:
Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
  - QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
  - 0

Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
  - QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
  - 0

Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
  - QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
  - 0

Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
  - QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
  - 0

Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
  - QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
  - 0

Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
  - QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
  - 0

Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
  - QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
  - 0

… and so on.

Of course, the output is more impressive if you have some other code in the
same file.

@p6rt
Copy link
Author

@p6rt p6rt commented Mar 21, 2016

@coke - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

@p6rt p6rt commented Jun 14, 2016

From zefram@fysh.org

$ perl6 -e '(;;)'
Non ast passed to UNWANTED​: BOOTInt
Non ast passed to UNWANTED​: BOOTInt
Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Weird node in analyze​: BOOTInt
===SORRY!===
Unknown QAST node type BOOTInt
$

'(;)' yields worse misbehaviour, with an infinite loop.

-zefram

@p6rt
Copy link
Author

@p6rt p6rt commented Jul 21, 2016

From @jnthn

On Fri Feb 05 15​:45​:19 2016, alex.jakimenko@​gmail.com wrote​:

But let's start with something less impressive.

Code​:
say [;0]

Result​:
Non ast passed to WANTED​: BOOTInt
Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Weird node in analyze​: BOOTInt
===SORRY!===
Unknown QAST node type BOOTInt

Woah! Ok, let's try this.

Code​:
[;]

Result​:
Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Weird node in analyze​: BOOTInt
===SORRY!===
Unknown QAST node type BOOTInt

Okay, that's a bit less impressive. Let's try with ()

Code​:
(;)

Result​:
Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
- QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
- 0

Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
- QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
- 0

Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
- QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
- 0

Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
- QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
- 0

Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
- QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
- 0

Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
- QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
- 0

Non-QAST node visited BOOTInt
Weird node visited​: BOOTInt
Resultchild 0 can't returns! BOOTInt
- QAST​::Stmts :BY<comp_unit ua u> :context<sink> #!/usr/bin/env perl6\n(;)
- QAST​::Stmt :BY<comp_unit ua u u> :context<sink> :final (;)
- 0

… and so on.

Of course, the output is more impressive if you have some other code in the
same file.

Fixed it so​:

* We won't infinite loop in that place if we hit it again
* We don't do the debug spam in the optimizer, unless the debug environment variable is turned on
* We don't go sticking a raw integer into the AST on such constructs, which is what caused all the trouble in the first place

Tests in integration/weird-errors.t.

@p6rt
Copy link
Author

@p6rt p6rt commented Jul 21, 2016

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

@p6rt p6rt closed this Jul 21, 2016
@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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant