-
Notifications
You must be signed in to change notification settings - Fork 171
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
Top level break
instruction causes panic on REPL
#584
Comments
Was looking into this today. Seem like something with the Goby 0.1.7 🙃 😚 😺
» [1, 2, 3].each do |i|
¤ break
» end
#» [1, 2, 3]
»
» y = 0
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x44006b5]
goroutine 1 [running]:
github.com/goby-lang/goby/vm.(*VM).REPLExec(0xc4200a6820, 0xc4201fa6c0, 0x3, 0x4)
/Users/julio/lib/go/src/github.com/goby-lang/goby/vm/repl.go:38 +0x435
github.com/goby-lang/goby/igb.StartIgb(0x459e471, 0x5)
/Users/julio/lib/go/src/github.com/goby-lang/goby/igb/repl.go:231 +0xc13
main.main()
/Users/julio/lib/go/src/github.com/goby-lang/goby/goby.go:29 +0x8fc |
Ran another test (see snippet below) and the problem seems to be related to the top level but not with the break statement being on the top level. I'm not really sure why, but some instruction on the top level after the a Goby 0.1.7 🤓 😐 🤧
» def foo
¤ [1, 2, 3].each do |i|
¤ break
¤ end
¤ y = 0
» end
#»
» foo
#» 0
» y = 0
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x60 pc=0x44006b5]
goroutine 1 [running]:
github.com/goby-lang/goby/vm.(*VM).REPLExec(0xc4200a68c0, 0xc420204cc0, 0x5, 0x8)
/Users/julio/lib/go/src/github.com/goby-lang/goby/vm/repl.go:38 +0x435
github.com/goby-lang/goby/igb.StartIgb(0x459e471, 0x5)
/Users/julio/lib/go/src/github.com/goby-lang/goby/igb/repl.go:231 +0xc13
main.main()
/Users/julio/lib/go/src/github.com/goby-lang/goby/goby.go:29 +0x8fc |
The following Goby code from https://github.com/goby-lang/goby/blob/master/vm/statement_test.go#L13 causes panic only on REPL:
Note that the code works fine when running as a file.
And the following works fine on REPL; looks like the bug only occurs on top level
break
instruction.FYI: complied with Go 1.9.3.
The text was updated successfully, but these errors were encountered: