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

Nil pointer dereference #2

Open
mibk opened this issue Nov 23, 2016 · 0 comments
Open

Nil pointer dereference #2

mibk opened this issue Nov 23, 2016 · 0 comments
Labels

Comments

@mibk
Copy link
Owner

mibk commented Nov 23, 2016

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
@mibk mibk added the bug label Nov 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant