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
Deep down in the Goaldi programming language interpreter,
one runtime interface assertion error has type and value
runtime.errorString [note: not a pointer]
runtime error: invalid memory address or nil pointer dereference
where in Go 1.6 it had type and value
*runtime.TypeAssertionError
interface conversion: *runtime.VNumber is not runtime.IVariable: missing method Assign
I was unable to reproduce this in a small example.
Here is, I hope, a working recipe for reproducing it in its original context.
It’s very possible that I’ve missed something — please don’t hesitate to e-mail
me with any questions (gmt@cs.arizona.edu).
—
Download or clone the latest Goaldi package from
github.com/proebsting/goaldi
Make the downloaded file tree the current directory.
Apply the patch below, which has the effect of showing the problem immediately
instead of passing it around and obscuring it.
Run “make boot” followed by “make build”.
(I’m assuming that "go" is in the command search path,
$GOPATH is set, and $GOPATH/bin is writable.)
Copy this code into a file “expt.gd”:
procedure main() {
1 := 2
}
Run “./goaldi -c expt.gd” followed by “./goaldi -x expt.gir”.
(I broke that into two explicit steps because the usual “goaldi expt.gd” command
actually runs the interpreter twice, with an implicit exec in the middle.
That can be really confusing if you want to set breakpoints etc.;
it’s the second run that demonstrates the problem.)
Expect to see:
PANIC(runtime.errorString) IN OPERATE():runtime error: invalid memory address or nil pointer dereference
Correct result would be:
PANIC(*runtime.TypeAssertionError) IN OPERATE():interface conversion: *runtime.VNumber is not runtime.IVariable: missing method Assign
—
Install this patch for quick reporting of the panic:
diff --git a/interp/operator.go b/interp/operator.go
index 887683a..bc99541 100644
--- a/interp/operator.go
+++ b/interp/operator.go
@@ -3,6 +3,7 @@
package main
import (
+ "os"
"fmt"
"goaldi/ir"
g "goaldi/runtime"
@@ -68,6 +69,13 @@ func getOperator(i *ir.Ir_OpFunction) *iOperator {
// operate() executes an iOperator insn corresponding to a Goaldi operator
func operate(env *g.Env, f *pr_frame, i *iOperator) (g.Value, *g.Closure) {
+defer func() {
+if x := recover(); x != nil {
+ fmt.Printf("PANIC(%T) IN OPERATE():%v\n", x, x)
+ os.Exit(1)
+}
+}()
+
// load and possibly dereference arguments
var lval, arg0, arg1, arg2 g.Value
arg0 = argval(f, i.Arg0, i.Flags&VAR0)
The text was updated successfully, but these errors were encountered:
Please answer these questions before submitting your issue. Thanks!
go version
)?go version go1.7beta2 darwin/amd64
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/gmt/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/75/4258h9pr8xj7dr0059bpx1400000gn/T/go-build875379403=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
This is a followup to my golang-dev posting
https://groups.google.com/forum/#!topic/golang-dev/3ffx1UPftAA
Deep down in the Goaldi programming language interpreter,
one runtime interface assertion error has type and value
runtime.errorString [note: not a pointer]
runtime error: invalid memory address or nil pointer dereference
where in Go 1.6 it had type and value
*runtime.TypeAssertionError
interface conversion: *runtime.VNumber is not runtime.IVariable: missing method Assign
I was unable to reproduce this in a small example.
Here is, I hope, a working recipe for reproducing it in its original context.
It’s very possible that I’ve missed something — please don’t hesitate to e-mail
me with any questions (gmt@cs.arizona.edu).
—
Download or clone the latest Goaldi package from
github.com/proebsting/goaldi
Make the downloaded file tree the current directory.
Apply the patch below, which has the effect of showing the problem immediately
instead of passing it around and obscuring it.
Run “make boot” followed by “make build”.
(I’m assuming that "go" is in the command search path,
$GOPATH is set, and $GOPATH/bin is writable.)
Copy this code into a file “expt.gd”:
Run “./goaldi -c expt.gd” followed by “./goaldi -x expt.gir”.
(I broke that into two explicit steps because the usual “goaldi expt.gd” command
actually runs the interpreter twice, with an implicit exec in the middle.
That can be really confusing if you want to set breakpoints etc.;
it’s the second run that demonstrates the problem.)
Expect to see:
PANIC(runtime.errorString) IN OPERATE():runtime error: invalid memory address or nil pointer dereference
Correct result would be:
PANIC(*runtime.TypeAssertionError) IN OPERATE():interface conversion: *runtime.VNumber is not runtime.IVariable: missing method Assign
—
Install this patch for quick reporting of the panic:
The text was updated successfully, but these errors were encountered: