Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: internal compiler error: panic: runtime error: invalid memory address or nil pointer dereference #54302

Closed
jmacd opened this issue Aug 5, 2022 · 5 comments
Labels
compiler/runtime NeedsInvestigation

Comments

@jmacd
Copy link

jmacd commented Aug 5, 2022

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

Installed the binary from https://go.dev/doc/install today:

$ go version
go version go1.19 darwin/amd64

Does this issue reproduce with the latest release?

Yes. Here is a play link:
https://go.dev/play/p/R_wq9G9RIFV
That pulls in https://github.com/lightstep/otel-launcher-go/tree/main/lightstep/sdk/metric/aggregator/minmaxsumcount, which compiles in 1.18 but not in 1.19

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/josh.macdonald/Library/Caches/go-build"
GOENV="/Users/josh.macdonald/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/josh.macdonald/src/lightstep/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/josh.macdonald/src/lightstep/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/josh.macdonald/src/opentelemetry/otel-launcher-go/lightstep/sdk/metric/go.mod"
GOWORK="/Users/josh.macdonald/src/opentelemetry/otel-launcher-go/go.work"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/hp/8_6w4qns7g79tww_56kst5nh0000gp/T/go-build4007331615=/tmp/go-build -gno-record-gcc-switches -fno-common"

This may be a duplicate of #54243

What did you expect to see?

In 1.18 this package compiles.

What did you see instead?

In 1.19, the error message:

# github.com/lightstep/otel-launcher-go/lightstep/sdk/metric/aggregator/minmaxsumcount
<autogenerated>:1: internal compiler error: panic: runtime error: invalid memory address or nil pointer dereference

Please file a bug report including a short program that triggers the error.
https://go.dev/issue/new
@seankhliao seankhliao changed the title go-1.19 internal compiler error: panic: runtime error: invalid memory address or nil pointer dereference cmd/compile: internal compiler error: panic: runtime error: invalid memory address or nil pointer dereference Aug 5, 2022
@gopherbot gopherbot added the compiler/runtime label Aug 5, 2022
@seankhliao seankhliao added the NeedsInvestigation label Aug 5, 2022
@seankhliao
Copy link
Member

seankhliao commented Aug 5, 2022

cc @golang/compiler

@mdempsky
Copy link
Member

mdempsky commented Aug 5, 2022

Minimized repro:

package p

func A() {
	B[int](nil)
}

func B[T any](iface interface{ M() }) {
	_ = iface.(*G[T])
}

type G[_ any] struct{}

func (*G[_]) M() {}

@mdempsky
Copy link
Member

mdempsky commented Aug 5, 2022

@gopherbot Please backport to Go 1.19. This is a regression from Go 1.18.

@gopherbot
Copy link

gopherbot commented Aug 5, 2022

Backport issue(s) opened: #54308 (for 1.18), #54309 (for 1.19).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.

@gopherbot
Copy link

gopherbot commented Aug 5, 2022

Change https://go.dev/cl/421755 mentions this issue: cmd/compile: fix import/export of ODYNAMICDOTTYPE

jproberts pushed a commit to jproberts/go that referenced this issue Aug 10, 2022
The RType field isn't needed when performing type assertions from
non-empty interface types, because we use the ITab field instead. But
the inline body exporter didn't know to expect this.

It's possible we could use a single bool to distinguish whether
we're serializing the RType or ITab field, but using two is simpler
and seems safer.

Fixes golang#54302.

Change-Id: I9ddac72784fb2241fee0a0dee30493d868a2c259
Reviewed-on: https://go-review.googlesource.com/c/go/+/421755
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

4 participants