Code Monkey home page Code Monkey logo

hawk's Issues

Nil pointer dereference

This Hawk program crashes:

{i[0%0]=0
y[1]++
z[i>y]}
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x28 pc=0x4cc1c4]

goroutine 1 [running]:
panic(0x51c440, 0xc42000e150)
	/home/michal/gostable/src/runtime/panic.go:500 +0x1a1
github.com/mibk/hawk/compiler/internal/hawkc.(*Program).Run.func1(0xc420041dd0)
	/home/michal/gopath/src/github.com/mibk/hawk/compiler/internal/hawkc/syntax.go:87 +0xb6
panic(0x51c440, 0xc42000e150)
	/home/michal/gostable/src/runtime/panic.go:458 +0x243
github.com/mibk/hawk/value.(*Array).Cmp(0xc4200124b0, 0x5ca0a0, 0xc42002e030, 0x1, 0x5ca0a0)
	/home/michal/gopath/src/github.com/mibk/hawk/value/array.go:104 +0x254
github.com/mibk/hawk/value.(*Undefined).Cmp(0xc42002e028, 0x5ca0a0, 0xc42002e030, 0x5ca0a0, 0xc42002e030)
	/home/michal/gopath/src/github.com/mibk/hawk/value/undefined.go:40 +0x165
github.com/mibk/hawk/compiler/internal/hawkc.(*BinaryExpr).Eval(0xc420010400, 0x5c8980, 0xc42002e010, 0x5ca0a0, 0xc42002e038)
	/home/michal/gopath/src/github.com/mibk/hawk/compiler/internal/hawkc/expr.go:220 +0x5ea
github.com/mibk/hawk/compiler/internal/hawkc.(*IndexExpr).Eval(0xc420010440, 0x5c8980, 0xc42002e010, 0x3, 0x3)
	/home/michal/gopath/src/github.com/mibk/hawk/compiler/internal/hawkc/expr.go:117 +0xa2
github.com/mibk/hawk/compiler/internal/hawkc.(*ExprStmt).Exec(0xc42000e540, 0x5c8980, 0xc42002e010, 0x0)
	/home/michal/gopath/src/github.com/mibk/hawk/compiler/internal/hawkc/stmt.go:30 +0x47
github.com/mibk/hawk/compiler/internal/hawkc.(*BlockStmt).Exec(0xc42000a7c0, 0x5c8980, 0xc42002e010, 0x0)
	/home/michal/gopath/src/github.com/mibk/hawk/compiler/internal/hawkc/stmt.go:40 +0x68
github.com/mibk/hawk/compiler/internal/hawkc.(*PatternAction).Exec(0xc42000a7e0, 0x5c8980, 0xc42002e010, 0x44cd50)
	/home/michal/gopath/src/github.com/mibk/hawk/compiler/internal/hawkc/syntax.go:149 +0x58
github.com/mibk/hawk/compiler/internal/hawkc.(*Program).Run(0xc42008a120, 0x5c8980, 0xc42002e010, 0x5c9180, 0xc42002e008, 0x0, 0x0)
	/home/michal/gopath/src/github.com/mibk/hawk/compiler/internal/hawkc/syntax.go:98 +0x129
github.com/mibk/hawk/compiler.(*Program).Run(0xc42008a120, 0x5c8980, 0xc42002e010, 0x5c9180, 0xc42002e008, 0x0, 0x0)
	/home/michal/gopath/src/github.com/mibk/hawk/compiler/compiler.go:35 +0x55
main.main()
	/home/michal/gopath/src/github.com/mibk/hawk/main.go:74 +0x4fd

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.