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: panic in cmd/compile/internal/gc.typecheck1 #27771

Closed
CmdrVasquess opened this issue Sep 20, 2018 · 6 comments

Comments

Projects
None yet
4 participants
@CmdrVasquess
Copy link

commented Sep 20, 2018

What did you do?

Working on my project BCplus (here on github) I changed the code then 'go build'

What did you expect to see?

Generally the build completes (sometimes with errors in my code, sometimes with success;)

What did you see instead?

I see ICE:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x70 pc=0xb7bbae]

goroutine 1 [running]:
cmd/compile/internal/gc.typecheck1(0xc00048c300, 0x2, 0xa8c9bb)
/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:1270 +0x3ece
cmd/compile/internal/gc.typecheck(0xc00048c300, 0x2, 0xc000489701)
/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:238 +0x6ad
cmd/compile/internal/gc.typecheck1(0xc00048c480, 0x2, 0x5002000000005)
/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:584 +0x2c8a
cmd/compile/internal/gc.typecheck(0xc00048c480, 0x2, 0x0)
/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:238 +0x6ad
cmd/compile/internal/gc.typecheck1(0xc00048c280, 0x1, 0x0)
/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:2051 +0xaaf9
cmd/compile/internal/gc.typecheck(0xc00048c280, 0x1, 0xb8f17f)
/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:238 +0x6ad
cmd/compile/internal/gc.typecheckslice(0xc000058140, 0x5, 0x8, 0x1)
/usr/local/go/src/cmd/compile/internal/gc/typecheck.go:68 +0x50
cmd/compile/internal/gc.Main(0xcc0f50)
/usr/local/go/src/cmd/compile/internal/gc/main.go:518 +0x2059
main.main()
/usr/local/go/src/cmd/compile/main.go:51 +0x96

System details

go version go1.11 linux/amd64
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/marcus/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/marcus/gows"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
GOROOT/bin/go version: go version go1.11 linux/amd64
GOROOT/bin/go tool compile -V: compile version go1.11
uname -sr: Linux 4.9.0-8-amd64
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.5 (stretch)
Release:	9.5
Codename:	stretch
/lib/x86_64-linux-gnu/libc.so.6: GNU C Library (Debian GLIBC 2.24-11+deb9u3) stable release version 2.24, by Roland McGrath et al.
gdb --version: GNU gdb (Debian 7.12-6) 7.12.0.20161007-git
@agnivade

This comment has been minimized.

Copy link
Member

commented Sep 20, 2018

It helps greatly if you link to the exact project or mention the exact steps to build it.

Is it this https://github.com/CmdrVasquess/BCplus ?

What are the exact steps to clone and build it ?

@CmdrVasquess

This comment has been minimized.

Copy link
Author

commented Sep 20, 2018

https://github.com/CmdrVasquess/BCplus is the project that produces the crash. Take the commit f2593416ec5faa5155d1b0de256771b9abf088cb into a clean go environment. Then 'go build' makes the compile crash – at least on my machine.

The following patch to webui/tpc_missions.go makes it compile again:

@@ -84,9 +84,9 @@ func (slv *tpcMsnSolver) best(
 	}
 }
 
-func (slv *tpcMsnSolver) solve(start *galaxy.Vec3D) (path []int, len float64) {
+func (slv *tpcMsnSolver) solve(start *galaxy.Vec3D) []int {
 	if len(slv.msns) == 0 {
-		return
+		return nil
 	}
 	optDist, optEnd, optPath := slv.best(start, 0)
 	optDist += vec3.Distance(&optEnd.Coos, start)

This is the go.mod from a crashing build (crashes every time):

module github.com/CmdrVasquess/BCplus

require (
	git.fractalqb.de/fractalqb/ggja v0.0.0-20180822120932-cfcce14db710
	git.fractalqb.de/fractalqb/goxic v0.0.0-20180826154226-2fac80e0dfac
	git.fractalqb.de/fractalqb/namemap v0.0.0-20180916111341-242eb440d994
	git.fractalqb.de/fractalqb/nmconv v0.0.0-20180623121133-1d05b732d337
	git.fractalqb.de/fractalqb/qblog v0.0.0-20180822120317-ffabfcd52ed5
	git.fractalqb.de/fractalqb/xsx v0.0.0-20180821141438-2616913ef5fe
	github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 // indirect
	github.com/BurntSushi/xgbutil v0.0.0-20160919175755-f7c97cef3b4e // indirect
	github.com/CmdrVasquess/goEDDNc v0.0.0-20180821143112-3b9bf9434eec
	github.com/CmdrVasquess/goEDSMc v0.0.0-20180724175852-5d4e25afaf88
	github.com/CmdrVasquess/watched v0.0.0-20180826154856-60bc5b699cc8
	github.com/fsnotify/fsnotify v1.4.7 // indirect
	github.com/go-vgo/robotgo v0.0.0-20180918115031-65901862eca5
	github.com/gofrs/uuid v3.1.0+incompatible
	github.com/gorilla/websocket v1.4.0
	github.com/mattn/go-sqlite3 v1.9.0
	github.com/robotn/gohook v0.0.0-20180917181714-40c3386427eb // indirect
	github.com/shirou/gopsutil v2.17.12+incompatible // indirect
	github.com/ungerik/go3d v0.0.0-20180509113627-aafc44e85fcf
	github.com/vcaesar/imgo v0.0.0-20180307100924-fece97d8745e // indirect
	github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
	github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
	github.com/xeipuuv/gojsonschema v0.0.0-20180816142147-da425ebb7609 // indirect
	golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81 // indirect
	golang.org/x/sys v0.0.0-20180919162611-1561086e645b // indirect
)

@bcmills bcmills changed the title 'go build' crashes with SIGSEGV cmd/compile: panic in cmd/compile/internal/gc.typecheck1 Sep 20, 2018

@agnivade

This comment has been minimized.

Copy link
Member

commented Sep 20, 2018

@CmdrVasquess

This comment has been minimized.

Copy link
Author

commented Sep 20, 2018

Could it be the return parameter name len that collides with the built-in function len()? See webui/tpc_missions.go line 87. With another name the thing compiles again!

@ALTree

This comment has been minimized.

Copy link
Member

commented Sep 20, 2018

Smells like #27356 and #27433. Closing here as a dup. This is already fixed on tip and it'll be backported in the next 1.11 minor release.

@ALTree ALTree closed this Sep 20, 2018

@CmdrVasquess

This comment has been minimized.

Copy link
Author

commented Sep 21, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.