Skip to content

Gno panics on fixedbugs/issue19040.go (Go runs it without error) #5667

@ltzmaxwell

Description

@ltzmaxwell

Gno panics on fixedbugs/issue19040.go (Go runs it without error)

Summary: Go runs this file without error; Gno crashes with an uncaught panic.

File adapted from Go's standard test corpus at test/fixedbugs/issue19040.go.

File fixedbugs/issue19040.go
Verdict PANIC_UNCAUGHT
Gno commit "a0162e074c48"

Triage notes

runtime panic in gno

Source

// run

// Copyright 2017 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Check the text of the panic that comes from
// a nil pointer passed to automatically generated method wrapper.

package main

import "fmt"

type T int

type I interface {
	F()
}

func (t T) F() {}

var (
	t *T
	i I = t
)

func main() {
	defer func() {
		got := recover().(error).Error()
		want := "value method main.T.F called using nil *T pointer"
		if got != want {
			fmt.Printf("panicwrap error text:\n\t%q\nwant:\n\t%q\n", got, want)
		}
	}()
	i.F()
}

Actual (Gno harness output)

unexpected panic: runtime error: nil pointer dereference
	string doesn't implement interface {Error func() string} (missing method Error)
output:

stacktrace:
panic: runtime error: nil pointer dereference
main<VPBlock(1,4)>()
    main/issue19040.go:36
panic: string doesn't implement interface {Error func() string} (missing method Error)
defer func(){ ... }()
    main/issue19040.go:30
main<VPBlock(1,4)>()
    main/issue19040.go:29

stack:
goroutine 333 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:26 +0x64
gnovm/pkg/test.(*TestOptions).runTest.func1()
	gnovm/pkg/test/filetest.go:367 +0xa0
panic({0x?, 0x?})
	/usr/local/go/src/runtime/panic.go:783 +0x?
gnovm/pkg/gnolang.(*Machine).runOnce.func1()
	gnovm/pkg/gnolang/machine.go:1505 +0x78
panic({0x?, 0x?})
	/usr/local/go/src/runtime/panic.go:783 +0x?
gnovm/pkg/gnolang.(*Machine).doOpReturnCallDefers(0x?)
	gnovm/pkg/gnolang/op_call.go:389 +0x?
gnovm/pkg/gnolang.(*Machine).runOnce(0x?)
	gnovm/pkg/gnolang/machine.go:1818 +0x?
gnovm/pkg/gnolang.(*Machine).Run(0x?, {0x?, 0x?})
	gnovm/pkg/gnolang/machine.go:1485 +0x84
gnovm/pkg/gnolang.(*Machine).RunStatement(0x?, {0x?, 0x8}, {0x?, 0x?})
	gnovm/pkg/gnolang/machine.go:1000 +0x?
gnovm/pkg/gnolang.(*Machine).runFunc(0x?, {0x?, 0x8}, {0x?, 0x4}, 0x2?)
	gnovm/pkg/gnolang/machine.go:845 +0x?
gnovm/pkg/gnolang.(*Machine).RunMain(...)
	gnovm/pkg/gnolang/machine.go:849
gnovm/pkg/test.(*TestOptions).runTest(0x?, 0x?, {0x?, 0x4}, {0x?, 0x?}, {0x?, 0x?, 0x?}, {0x0, ...}, ...)
	gnovm/pkg/test/filetest.go:431 +0x?
gnovm/pkg/test.(*TestOptions).runFiletest(0x?, {0x?, 0xd}, {0x?, 0x?, 0x?}, {0x?, 0x?}, 0x1)
	gnovm/pkg/test/filetest.go:86 +0x?
gnovm/pkg/test.(*TestOptions).RunFiletest(0x?, {0x?, 0x0?}, {0x?, 0x0?, 0x0?}, {0x?, 0x?})
	gnovm/pkg/test/filetest.go:35 +0x78

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions