For loop crashes compiler #1981

Closed
alex opened this Issue Nov 3, 2012 · 0 comments

Comments

Projects
None yet
2 participants

alex commented Nov 3, 2012

Trying to run: for Const in []; end crashes the rubinius compiler:

Alexs-MacBook-Pro-2:dir alex_gaynor$ rbx-head -X19 -e 'for Const in []; end'
An exception occurred evaluating command line code
    undefined method `bytecode' on nil:NilClass. (NoMethodError)

Backtrace:
                           Kernel(NilClass)#bytecode (method_missing) at kernel/delta/kernel.rb:81
                       Rubinius::AST::ConstantAccess#assign_bytecode at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/ast
                                                                        /constants.rbc:209
                          Rubinius::AST::ConstantAssignment#bytecode at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/ast
                                                                        /constants.rbc:296
                               Rubinius::AST::For19Arguments#bytecode at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/ast/sends.rbc:837
                   Rubinius::AST::Iter(Rubinius::AST::For19)#bytecode at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/ast/sends.rbc:576
                                         Rubinius::AST::Send#bytecode at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/ast/sends.rbc:35
                       { } in Rubinius::AST::EvalExpression#bytecode at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/ast
                                                                        /definitions.rbc:1034
 Rubinius::AST::Container(Rubinius::AST::EvalExpression)#container_bytecode at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/ast
                                                                               /definitions.rbc:956
                              Rubinius::AST::EvalExpression#bytecode at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/ast
                                                                        /definitions.rbc:1033
                                    Rubinius::Compiler::Generator#run at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/stages.rbc:153
   Rubinius::Compiler::Stage(Rubinius::Compiler::EvalParser)#run_next at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/stages.rbc:53
       Rubinius::Compiler::Parser(Rubinius::Compiler::EvalParser)#run at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/stages.rbc:210
                                               Rubinius::Compiler#run at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/compiler.rbc:374
                                      Rubinius::Compiler.compile_eval at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/compiler.rbc:302
                                   Rubinius::Compiler.construct_block at /Users/alex_gaynor/.rvm/rubies/rbx-head/runtime/19/compiler/compiler.rbc:314
                                        Kernel(Rubinius::Loader)#eval at kernel/common/eval.rb:70
                                               Rubinius::Loader#evals at kernel/loader.rb:589
                                                Rubinius::Loader#main at kernel/loader.rb:822

This code runs fine on jruby and Cruby.

@IPGlider IPGlider closed this in 31686de Nov 27, 2012

IPGlider added a commit that referenced this issue Nov 27, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment