You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
) demo
# This is a demo of ivy. Type a newline to advance to each new step. Type one now.
? 2 ** 32
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
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=0x0 pc=0x49ace4]
goroutine 6 [running]:
robpike.io/ivy/parse.(*Parser).runFromReader.func1()
/home/aurelien/godev/pkg/mod/robpike.io/ivy@v0.1.7/parse/special.go:358 +0x1ea
panic({0x4fa4e0, 0x5fbc80})
/home/aurelien/sdk/go1.17.4/src/runtime/panic.go:1038 +0x215
robpike.io/ivy/parse.(*Parser).runUntilError.func1()
/home/aurelien/godev/pkg/mod/robpike.io/ivy@v0.1.7/parse/special.go:384 +0x1ea
panic({0x4fa4e0, 0x5fbc80})
/home/aurelien/sdk/go1.17.4/src/runtime/panic.go:1038 +0x215
math/big.(*Int).Add(0xc0000a8080, 0x49a93f, 0x0)
/home/aurelien/sdk/go1.17.4/src/math/big/int.go:118 +0x24
robpike.io/ivy/value.bigIntRand({0x544d70, 0xc0000753e0}, 0xffffffffffffffff, 0x4108b7)
/home/aurelien/godev/pkg/mod/robpike.io/ivy@v0.1.7/value/unary.go:56 +0x77
robpike.io/ivy/value.unaryBigIntOp({0x544d70, 0xc0000753e0}, 0x5201e0, {0x544eb0, 0xc0000a8060})
/home/aurelien/godev/pkg/mod/robpike.io/ivy@v0.1.7/value/unary.go:21 +0x8d
robpike.io/ivy/value.init.1.func2({0x544d70, 0xc0000753e0}, {0x544eb0, 0xc0000a8060})
/home/aurelien/godev/pkg/mod/robpike.io/ivy@v0.1.7/value/unary.go:137 +0x71
robpike.io/ivy/value.(*unaryOp).EvalUnary(0xc00007e050, {0x544d70, 0xc0000753e0}, {0x544eb0, 0xc0000a8060})
/home/aurelien/godev/pkg/mod/robpike.io/ivy@v0.1.7/value/eval.go:52 +0x119
robpike.io/ivy/exec.(*Context).EvalUnary(0xc0000753e0, {0xc0000a2020, 0x1}, {0x544eb0, 0xc0000a8060})
/home/aurelien/godev/pkg/mod/robpike.io/ivy@v0.1.7/exec/context.go:138 +0x128
robpike.io/ivy/parse.(*unary).Eval(0xc0000a8000, {0x544d70, 0xc0000753e0})
/home/aurelien/godev/pkg/mod/robpike.io/ivy@v0.1.7/parse/parse.go:193 +0x62
robpike.io/ivy/parse.(*Parser).runUntilError(0xc00009c000, {0x50f24a, 0x0})
/home/aurelien/godev/pkg/mod/robpike.io/ivy@v0.1.7/parse/special.go:389 +0x113
robpike.io/ivy/parse.(*Parser).runFromReader(0xc000154d80, {0x544d70, 0xc0000753e0}, {0x50f24a, 0x0}, {0x541ca0, 0xc000176d80}, 0x0)
/home/aurelien/godev/pkg/mod/robpike.io/ivy@v0.1.7/parse/special.go:362 +0x3ca
created by robpike.io/ivy/parse.DemoRunner
/home/aurelien/godev/pkg/mod/robpike.io/ivy@v0.1.7/parse/special.go:434 +0x1ef
The fix is easy but since this is relatively minor (only happens during demo) and since there are different ways to fix it I'm not opening a PR, preferring to check if you're interested to fix this, and how.
When the demo starts, DemoRunner is provided a zero-valued default config.Config. Config.bigOrigin is a nil big.Int. Also, Config.BigOrigin() doesn't call Config.init(). Finally, Config.init doesn't initialize Config.bigOrigin.
What is the platform you are on? And what version of ivy are you (what is the head commit)? I can't reproduce it. I'd like to do that so I can write a test to verify the fix.
Reproducer:
The fix is easy but since this is relatively minor (only happens during demo) and since there are different ways to fix it I'm not opening a PR, preferring to check if you're interested to fix this, and how.
When the demo starts,
DemoRunner
is provided a zero-valued defaultconfig.Config
.Config.bigOrigin
is a nilbig.Int
. Also,Config.BigOrigin()
doesn't callConfig.init()
. Finally,Config.init
doesn't initializeConfig.bigOrigin
.One possible fix:
The text was updated successfully, but these errors were encountered: