Skip to content

cmd/compile: internal compiler error: OCALLMETH missed by typecheck #57309

@dbc60

Description

@dbc60

What version of Go are you using (go version)?

$ go version
go version go1.19.4 windows/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\dcuthbertson\AppData\Local\go-build
set GOENV=C:\Users\dcuthbertson\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\dcuthbertson\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\dcuthbertson\go
set GOPRIVATE=
set GOROOT=C:\local\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\local\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.19.4
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\dcuthbertson\repos\boom\go.mod
set GOWORK=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\DCUTHB~1\AppData\Local\Temp\go-build1037280389=/tmp/go-build -gno-record-gcc-switches

What did you do?

I ran go test -v on the following code in pruner_test.go:

package prune

import (
	"os"
	"testing"

	"github.com/spf13/afero"
)

func TestPruner_Prune(t *testing.T) {
	testIO := []struct {
		name string
		fs   afero.Fs
	}{
		{
			name: "a simple test",
			fs: func() afero.Fs {
				fs := afero.NewMemMapFs()
				_ = fs.Mkdir("/proc/2", os.ModeDir)
				// Uncomment the next two lines prevent a compiler error
				//_ = afero.WriteFile(fs, "/proc/2/stat", []byte("2 (tail) S 1 SKIP 12"), 0777)
				//_ = fs.Remove("/proc/2/stat")

				return fs
			}(),
		},
	}

	for _, test := range testIO {
		t.Run(test.name, func(t *testing.T) {
		})
	}
}

What did you expect to see?

=== RUN   TestPruner_Prune
=== RUN   TestPruner_Prune/a_simple_test
--- PASS: TestPruner_Prune (0.00s)
    --- PASS: TestPruner_Prune/a_simple_test (0.00s)
PASS
ok      example.com/boom        0.310s

What did you see instead?

# example.com/boom [example.com/boom.test]
.\pruner_test.go:19:17: internal compiler error: OCALLMETH missed by typecheck

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new
FAIL    example.com/boom [build failed]

This compiler error can be avoided by uncommenting the two lines of commented-out code indicated in the source above. regardless, I believe the compiler shouldn't fail in either case.

Metadata

Metadata

Assignees

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions