Skip to content

Gno panics on fixedbugs/bug406.go (Go runs it without error) #5664

@ltzmaxwell

Description

@ltzmaxwell

Gno panics on fixedbugs/bug406.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/bug406.go.

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

Triage notes

runtime panic in gno

Source

// run

// Copyright 2012 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.

// Issue 2821
package main

type matrix struct {
	e []int
}

func (a matrix) equal() bool {
	for _ = range a.e {
	}
	for range a.e {
	}
	return true
}

func main() {
	var a matrix
	var i interface{}
	i = true && a.equal()
	_ = i
}

Actual (Gno harness output)

unexpected panic: runtime error: invalid memory address or nil pointer dereference
output:

stacktrace:

stack:
goroutine 261 [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.doRecover({0x?, 0x4, 0x20}, {0x?, 0x?})
	gnovm/pkg/gnolang/preprocess.go:606 +0x?
panic({0x?, 0x?})
	/usr/local/go/src/runtime/panic.go:783 +0x?
gnovm/pkg/gnolang.assertIndexTypeIsInt({0x0, 0x0})
	gnovm/pkg/gnolang/type_check.go:823 +0x20
gnovm/pkg/gnolang.(*RangeStmt).AssertCompatible(0x?, {0x?, 0x?}, {0x?, 0x?})
	gnovm/pkg/gnolang/type_check.go:853 +0x?
gnovm/pkg/gnolang.preprocess1.func1({0x?, 0x2, 0x20}, 0x46, 0x0, {0x?, 0x?}, 0x3)
	gnovm/pkg/gnolang/preprocess.go:2765 +0x?
gnovm/pkg/gnolang.transcribe(0x?, {0x?, 0x2, 0x20}, 0x46, 0x0, {0x?, 0x?}, 0x?)
	gnovm/pkg/gnolang/transcribe.go:706 +0x?
gnovm/pkg/gnolang.transcribe(0x?, {0x?, 0x1, 0x20}, 0x4e, 0x1, {0x?, 0x?}, 0x?)
	gnovm/pkg/gnolang/transcribe.go:646 +0x?
gnovm/pkg/gnolang.transcribe(0x?, {0x?, 0x0, 0x20}, 0x0, 0x0, {0x?, 0x?}, 0x?)
	gnovm/pkg/gnolang/transcribe.go:688 +0x?
gnovm/pkg/gnolang.Transcribe({0x?, 0x?}, 0x?)
	gnovm/pkg/gnolang/transcribe.go:133 +0xa8
gnovm/pkg/gnolang.preprocess1({0x?, 0x?}, {0x?, 0x?}, {0x?, 0x?})
	gnovm/pkg/gnolang/preprocess.go:717 +0x?
gnovm/pkg/gnolang.Preprocess({0x?, 0x?}, {0x?, 0x?}, {0x?, 0x?})
	gnovm/pkg/gnolang/preprocess.go:661 +0x7c
gnovm/pkg/gnolang.(*Machine).runFileDecls(0x?, 0x1, {0x?, 0x1, 0x1})
	gnovm/pkg/gnolang/machine.go:640 +0x?
gnovm/pkg/gnolang.(*Machine).RunFiles(0x?, {0x?, 0x1, 0x1})
	gnovm/pkg/gnolang/machine.go:503 +0x?
gnovm/pkg/test.(*TestOptions).runTest(0x?, 0x?, {0x?, 0x4}, {0x?, 0x?}, {0x?, 0x?, 0x?}, {0x0, ...}, ...)
	gnovm/pkg/test/filetest.go:430 +0x?
gnovm/pkg/test.(*TestOptions).runFiletest(0x?, {0x?, 0x9}, {0x?, 0x?, 0x?}, {0x?, 0x?}, 0x1)
	gnovm/pkg/test/filetest.go:86 +0x?
gnovm/pkg/test.(*TestOptions).RunFiletest(0x0?, {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