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: compiler crash during typecheking on len variable #27803

Closed
kempeng opened this issue Sep 21, 2018 · 1 comment
Closed

cmd/compile: compiler crash during typecheking on len variable #27803

kempeng opened this issue Sep 21, 2018 · 1 comment

Comments

@kempeng
Copy link

@kempeng kempeng commented Sep 21, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.11 windows/amd64

Does this issue reproduce with the latest release?

yes

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

PS C:\Users\geert\go\src\gnarb\alerter> go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\geert\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\geert\go
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
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 -fmessage-length=0 -fdebug-prefix-map=C:\Users\geert\AppData\Local\Temp\go-build068033874=/tmp/go-build -gno-record-gcc-switches

What did you do?

try to compile a new piece of code

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.
I created a new function:

//NewMaps allocates the ResultItem maps
func (r *ResultItem) NewMaps(len int) {
...
}

What did you expect to see?

the go compile to compile the code (go compiler in powershell as integrated terminal in VSC)

What did you see instead?

PS C:\Users\geert\go\src\gnarb\alerter> go build

gnarb/chain

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x70 pc=0xb94675]

goroutine 1 [running]:
cmd/compile/internal/gc.typecheck1(0xc0006ad100, 0x2, 0x9f1f00000000b)
c:/go/src/cmd/compile/internal/gc/typecheck.go:1270 +0x3ed5
cmd/compile/internal/gc.typecheck(0xc0006ad100, 0x2, 0x0)
c:/go/src/cmd/compile/internal/gc/typecheck.go:238 +0x6b4
cmd/compile/internal/gc.typecheck1(0xc0006ad280, 0x2, 0xc0006a63c0)
c:/go/src/cmd/compile/internal/gc/typecheck.go:584 +0x2c91
cmd/compile/internal/gc.typecheck(0xc0006ad280, 0x2, 0x0)
c:/go/src/cmd/compile/internal/gc/typecheck.go:238 +0x6b4
cmd/compile/internal/gc.typecheck1(0xc0006ad080, 0x1, 0xc0006abd80)
c:/go/src/cmd/compile/internal/gc/typecheck.go:2051 +0xab00
cmd/compile/internal/gc.typecheck(0xc0006ad080, 0x1, 0xba7d56)
c:/go/src/cmd/compile/internal/gc/typecheck.go:238 +0x6b4
cmd/compile/internal/gc.typecheckslice(0xc0006a0aa0, 0x4, 0x4, 0x1)
c:/go/src/cmd/compile/internal/gc/typecheck.go:68 +0x57
cmd/compile/internal/gc.Main(0xcdea30)
c:/go/src/cmd/compile/internal/gc/main.go:518 +0x20d0
main.main()
c:/go/src/cmd/compile/main.go:51 +0x9d

Renaming NewMaps in the COMMENT resolved the runtime error:
//NewAMaps allocate the ResultItem maps
func (r *ResultItem) NewMaps(len int) {
...
}

@ALTree

This comment has been minimized.

Copy link
Member

@ALTree ALTree commented Sep 21, 2018

Thanks for the report.

This was reported a few days ago (#27771, #27356, #27433), and it's already fixed on tip. It'll also be backported in the next 1.11 minor release. Closing here as dup.

@ALTree ALTree closed this Sep 21, 2018
@ALTree ALTree changed the title go compiler runtime item cmd/compile: compiler crash during typecheking on len variable Sep 21, 2018
@golang golang locked and limited conversation to collaborators Sep 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.