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: unexpected Interface for <nil> while building Kubernetes #30430

Closed
sudeeshjohn opened this issue Feb 27, 2019 · 9 comments

Comments

Projects
None yet
7 participants
@sudeeshjohn
Copy link

commented Feb 27, 2019

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

$ go version
go version devel +4a91d55 Wed Feb 27 04:34:51 2019 +0000 linux/ppc64le

Does this issue reproduce with the latest release?

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

go env Output
$ go env
GOARCH="ppc64le"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="ppc64le"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/go/containerd_ws"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_ppc64le"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build637435105=/tmp/go-build -gno-record-gcc-switches"

What did you do?

git clone https://github.com/kubernetes/kubernetes.git
make all

What did you expect to see?

build should be successful

What did you see instead?

+++ [0227 10:25:19] Building go targets for linux/ppc64le:
    ./vendor/k8s.io/code-generator/cmd/deepcopy-gen
+++ [0227 10:25:28] Building go targets for linux/ppc64le:
    ./vendor/k8s.io/code-generator/cmd/defaulter-gen
+++ [0227 10:25:34] Building go targets for linux/ppc64le:
    ./vendor/k8s.io/code-generator/cmd/conversion-gen
+++ [0227 10:25:46] Building go targets for linux/ppc64le:
    ./vendor/k8s.io/kube-openapi/cmd/openapi-gen
2019/02/27 10:25:54 Code for OpenAPI definitions generated
+++ [0227 10:25:55] Building go targets for linux/ppc64le:
    ./vendor/github.com/jteeuwen/go-bindata/go-bindata
+++ [0227 10:25:56] Building go targets for linux/ppc64le:
    cmd/kube-proxy
    cmd/kube-apiserver
    cmd/kube-controller-manager
    cmd/cloud-controller-manager
    cmd/kubelet
    cmd/kubeadm
    cmd/hyperkube
    cmd/kube-scheduler
    vendor/k8s.io/apiextensions-apiserver
    cluster/gce/gci/mounter
    cmd/kubectl
    cmd/gendocs
    cmd/genkubedocs
    cmd/genman
    cmd/genyaml
    cmd/genswaggertypedocs
    cmd/linkcheck
    vendor/github.com/onsi/ginkgo/ginkgo
    test/e2e/e2e.test
    cmd/kubemark
    vendor/github.com/onsi/ginkgo/ginkgo
    test/e2e_node/e2e_node.test
# k8s.io/kubernetes/vendor/k8s.io/apiextensions-apiserver
/usr/local/go/pkg/tool/linux_ppc64le/link: running gcc failed: fork/exec /usr/bin/gcc: cannot allocate memory

# k8s.io/kubernetes/cmd/kubelet
/usr/local/go/pkg/tool/linux_ppc64le/link: running gcc failed: fork/exec /usr/bin/gcc: cannot allocate memory

# k8s.io/kubernetes/cmd/genyaml
/usr/local/go/pkg/tool/linux_ppc64le/link: running gcc failed: fork/exec /usr/bin/gcc: cannot allocate memory

# k8s.io/kubernetes/cmd/hyperkube
fatal error: runtime: out of memory

runtime stack:
runtime.throw(0x279be3, 0x16)
	/usr/local/go/src/runtime/panic.go:627 +0x5c
runtime.sysMap(0xc068000000, 0x8000000, 0x466a18)
	/usr/local/go/src/runtime/mem_linux.go:170 +0xcc
runtime.(*mheap).sysAlloc(0x448d20, 0x6e80000, 0x448d30, 0x3740)
	/usr/local/go/src/runtime/malloc.go:633 +0x194
runtime.(*mheap).grow(0x448d20, 0x3740, 0x0)
	/usr/local/go/src/runtime/mheap.go:1232 +0x3c
runtime.(*mheap).allocSpanLocked(0x448d20, 0x3740, 0x466a28, 0xc000000100)
	/usr/local/go/src/runtime/mheap.go:1150 +0x3fc
runtime.(*mheap).alloc_m(0x448d20, 0x3740, 0x320100, 0x448d28)
	/usr/local/go/src/runtime/mheap.go:977 +0xb0
runtime.(*mheap).alloc.func1()
	/usr/local/go/src/runtime/mheap.go:1048 +0x4c
runtime.systemstack(0xc000863ee8)
	/usr/local/go/src/runtime/asm_ppc64x.s:286 +0xd4
runtime.(*mheap).alloc(0x448d20, 0x3740, 0x10100, 0x3fff774100d8)
	/usr/local/go/src/runtime/mheap.go:1047 +0x7c
runtime.largeAlloc(0x6e80000, 0x230001, 0x3fff73270ab8)
	/usr/local/go/src/runtime/malloc.go:1055 +0x94
runtime.mallocgc.func1()
	/usr/local/go/src/runtime/malloc.go:950 +0x48
runtime.systemstack(0x40500)
	/usr/local/go/src/runtime/asm_ppc64x.s:260 +0x94
runtime.mstart()
	/usr/local/go/src/runtime/proc.go:1153

goroutine 1 [running]:
runtime.systemstack_switch()
	/usr/local/go/src/runtime/asm_ppc64x.s:207 +0x10 fp=0xc000822698 sp=0xc000822678 pc=0x66ca0
runtime.mallocgc(0x6e80000, 0x24ba80, 0xc06461e401, 0x271a02)
	/usr/local/go/src/runtime/malloc.go:949 +0x868 fp=0xc000822758 sp=0xc000822698 pc=0x1af28
runtime.newarray(0x24ba80, 0x88000, 0xae)
	/usr/local/go/src/runtime/malloc.go:1085 +0x88 fp=0xc000822798 sp=0xc000822758 pc=0x1b348
runtime.makeBucketArray(0x230e20, 0x13, 0x0, 0xc06461e460, 0xc06461e460)
	/usr/local/go/src/runtime/map.go:364 +0x1b4 fp=0xc0008227e0 sp=0xc000822798 pc=0x1c394
runtime.hashGrow(0x230e20, 0xc0000846f0)
	/usr/local/go/src/runtime/map.go:1035 +0x9c fp=0xc000822840 sp=0xc0008227e0 pc=0x1e0dc
runtime.mapassign_faststr(0x230e20, 0xc0000846f0, 0xc06461e460, 0xd5, 0x4665e0)
	/usr/local/go/src/runtime/map_faststr.go:272 +0x138 fp=0xc0008228b8 sp=0xc000822840 pc=0x21978
cmd/link/internal/sym.(*Symbols).Lookup(0xc00008e0f0, 0xc06461e460, 0xd5, 0x0, 0xc0644663a0)
	/usr/local/go/src/cmd/link/internal/sym/symbols.go:79 +0x160 fp=0xc000822948 sp=0xc0008228b8 pc=0xfb3c0
cmd/link/internal/objfile.(*objReader).readRef(0xc000822cd0)
	/usr/local/go/src/cmd/link/internal/objfile/objfile.go:395 +0xc8 fp=0xc000822a40 sp=0xc000822948 pc=0x131a48
cmd/link/internal/objfile.(*objReader).loadObjFile(0xc000822cd0)
	/usr/local/go/src/cmd/link/internal/objfile/objfile.go:110 +0x26c fp=0xc000822be8 sp=0xc000822a40 pc=0x12f4dc
cmd/link/internal/objfile.Load(0x434d80, 0xc00008e0f0, 0xc017353760, 0xc03d0c9e10, 0x16709, 0xc0645f1b80, 0x97)
	/usr/local/go/src/cmd/link/internal/objfile/objfile.go:70 +0x18c fp=0xc000822de8 sp=0xc000822be8 pc=0x12f0dc
cmd/link/internal/ld.ldobj(0xc0006ac000, 0xc017353760, 0xc03d0c9e10, 0x16797, 0xc0645f1b80, 0x97, 0xc00075c49d, 0x8f, 0x0)
	/usr/local/go/src/cmd/link/internal/ld/lib.go:1659 +0x96c fp=0xc000822f98 sp=0xc000822de8 pc=0x1883fc
cmd/link/internal/ld.loadobjfile(0xc0006ac000, 0xc03d0c9e10)
	/usr/local/go/src/cmd/link/internal/ld/lib.go:889 +0x380 fp=0xc000823140 sp=0xc000822f98 pc=0x182230
cmd/link/internal/ld.(*Link).loadlib(0xc0006ac000)
	/usr/local/go/src/cmd/link/internal/ld/lib.go:381 +0x170 fp=0xc000823350 sp=0xc000823140 pc=0x17ef20
cmd/link/internal/ld.Main(0x434d80, 0x10, 0x20, 0x1, 0x1, 0x41, 0x2763cb, 0x10, 0x271c44, 0x3, ...)
	/usr/local/go/src/cmd/link/internal/ld/main.go:207 +0xb24 fp=0xc0008234d0 sp=0xc000823350 pc=0x197804
main.main()
	/usr/local/go/src/cmd/link/main.go:65 +0x238 fp=0xc000823f68 sp=0xc0008234d0 pc=0x1f66e8
runtime.main()
	/usr/local/go/src/runtime/proc.go:200 +0x24c fp=0xc000823fc0 sp=0xc000823f68 pc=0x3d58c
runtime.goexit()
	/usr/local/go/src/runtime/asm_ppc64x.s:857 +0x4 fp=0xc000823fc0 sp=0xc000823fc0 pc=0x69224
/usr/local/go/pkg/tool/linux_ppc64le/link: signal: killed
/usr/local/go/pkg/tool/linux_ppc64le/link: signal: killed
# k8s.io/kubernetes/cmd/kubemark
/usr/local/go/pkg/tool/linux_ppc64le/link: running gcc failed: fork/exec /usr/bin/gcc: cannot allocate memory

!!! [0227 10:29:56] Call tree:
!!! [0227 10:29:56]  1: /go/containerd_ws/src/github.com/k8s.io/kubernetes/hack/lib/golang.sh:624 kube::golang::build_some_binaries(...)
!!! [0227 10:29:56]  2: /go/containerd_ws/src/github.com/k8s.io/kubernetes/hack/lib/golang.sh:758 kube::golang::build_binaries_for_platform(...)
!!! [0227 10:29:56]  3: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0227 10:29:56] Call tree:
!!! [0227 10:29:56]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0227 10:29:56] Call tree:
!!! [0227 10:29:56]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
Makefile:92: recipe for target 'all' failed
make: *** [all] Error 1

looks like the commit 6fa7669 introduced the issue.

@agnivade agnivade changed the title Kubernetes building is failing runtime: out of memory while building Kubernetes Feb 27, 2019

@agnivade

This comment has been minimized.

Copy link
Member

commented Feb 27, 2019

@sudeeshjohn

This comment has been minimized.

Copy link
Author

commented Feb 27, 2019

My bad, unfortunately the error log I pasted is different, pasting the right log:

+++ [0227 18:36:44] Building go targets for linux/ppc64le:
    cmd/kube-proxy
    cmd/kube-apiserver
    cmd/kube-controller-manager
    cmd/cloud-controller-manager
    cmd/kubelet
    cmd/kubeadm
    cmd/hyperkube
    cmd/kube-scheduler
    vendor/k8s.io/apiextensions-apiserver
    cluster/gce/gci/mounter
    cmd/kubectl
    cmd/gendocs
    cmd/genkubedocs
    cmd/genman
    cmd/genyaml
    cmd/genswaggertypedocs
    cmd/linkcheck
    vendor/github.com/onsi/ginkgo/ginkgo
    test/e2e/e2e.test
    cmd/kubemark
    vendor/github.com/onsi/ginkgo/ginkgo
    test/e2e_node/e2e_node.test
# k8s.io/kubernetes/test/e2e/storage
test/e2e/storage/pd.go:203:86: internal compiler error: unexpected Interface for <nil>

goroutine 1 [running]:
runtime/debug.Stack(0xb03f40, 0xc0001cc008, 0x0)
	/go/src/golang/go/src/runtime/debug/stack.go:24 +0x8c
cmd/compile/internal/gc.Fatalf(0x94c976, 0x1b, 0xc001965e90, 0x1, 0x1)
	/go/src/golang/go/src/cmd/compile/internal/gc/subr.go:190 +0x29c
cmd/compile/internal/gc.Val.Interface(0x0, 0x0, 0x0, 0x8a98a0)
	/go/src/golang/go/src/cmd/compile/internal/gc/const.go:98 +0x28c
cmd/compile/internal/gc.(*constSet).add(0xc001966130, 0xc001615590, 0x93cc26)
	/go/src/golang/go/src/cmd/compile/internal/gc/const.go:1477 +0x120
cmd/compile/internal/gc.typecheckcomplit(0xc001622a80, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:3089 +0xbac
cmd/compile/internal/gc.typecheck1(0xc001622a80, 0x2, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:902 +0x4538
cmd/compile/internal/gc.typecheck(0xc001622a80, 0x2, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6a0
cmd/compile/internal/gc.typecheckslice(0xc0007e6a40, 0x4, 0x4, 0x2)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x64
cmd/compile/internal/gc.typecheck1(0xc001622980, 0x1, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:1324 +0x3628
cmd/compile/internal/gc.typecheck(0xc001622980, 0x1, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6a0
cmd/compile/internal/gc.typecheckslice(0xc0001d6940, 0x6, 0x8, 0x1)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x64
cmd/compile/internal/gc.typecheck1(0xc001622280, 0x1, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:2148 +0xa49c
cmd/compile/internal/gc.typecheck(0xc001622280, 0x1, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6a0
cmd/compile/internal/gc.typecheckslice(0xc000b1c200, 0x23, 0x40, 0x1)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x64
cmd/compile/internal/gc.typecheckclosure(0xc000fbb340, 0x2)
	/go/src/golang/go/src/cmd/compile/internal/gc/closure.go:111 +0x21c
cmd/compile/internal/gc.typecheck1(0xc000fbb340, 0x2, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:2017 +0x40e8
cmd/compile/internal/gc.typecheck(0xc000fbb340, 0x2, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6a0
cmd/compile/internal/gc.typecheckslice(0xc000a29540, 0x2, 0x2, 0x2)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x64
cmd/compile/internal/gc.typecheck1(0xc001612780, 0x1, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:1324 +0x3628
cmd/compile/internal/gc.typecheck(0xc001612780, 0x1, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6a0
cmd/compile/internal/gc.typecheckslice(0xc0004e76e0, 0x4, 0x4, 0x1)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x64
cmd/compile/internal/gc.typecheckrange(0xc001612180)
	/go/src/golang/go/src/cmd/compile/internal/gc/range.go:36 +0xf4
cmd/compile/internal/gc.typecheck1(0xc001612180, 0x1, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:2181 +0xa690
cmd/compile/internal/gc.typecheck(0xc001612180, 0x1, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6a0
cmd/compile/internal/gc.typecheckslice(0xc0001d6600, 0x7, 0x8, 0x1)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x64
cmd/compile/internal/gc.typecheckclosure(0xc000fbb080, 0x2)
	/go/src/golang/go/src/cmd/compile/internal/gc/closure.go:111 +0x21c
cmd/compile/internal/gc.typecheck1(0xc000fbb080, 0x2, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:2017 +0x40e8
cmd/compile/internal/gc.typecheck(0xc000fbb080, 0x2, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6a0
cmd/compile/internal/gc.typecheckslice(0xc000a29580, 0x2, 0x2, 0x2)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x64
cmd/compile/internal/gc.typecheck1(0xc000f36600, 0x1, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:1324 +0x3628
cmd/compile/internal/gc.typecheck(0xc000f36600, 0x1, 0x0)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6a0
cmd/compile/internal/gc.typecheckslice(0xc001610000, 0x14, 0x1c, 0x1)
	/go/src/golang/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x64
cmd/compile/internal/gc.Main(0x962028)
	/go/src/golang/go/src/cmd/compile/internal/gc/main.go:545 +0x2c88
main.main()
	/go/src/golang/go/src/cmd/compile/main.go:51 +0xbc

!!! [0227 18:38:11] Call tree:
!!! [0227 18:38:11]  1: /go/src/k8s.io/kubernetes/hack/lib/golang.sh:758 kube::golang::build_binaries_for_platform(...)
!!! [0227 18:38:11]  2: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0227 18:38:11] Call tree:
!!! [0227 18:38:11]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
!!! [0227 18:38:11] Call tree:
!!! [0227 18:38:11]  1: hack/make-rules/build.sh:27 kube::golang::build_binaries(...)
Makefile:92: recipe for target 'all' failed
make: *** [all] Error 1

@sudeeshjohn sudeeshjohn changed the title runtime: out of memory while building Kubernetes Kubernetes building is failing runtime Feb 27, 2019

@mkumatag

This comment has been minimized.

Copy link

commented Feb 27, 2019

This seems like happening in latest code got merged in the golang via 6fa7669
CL: https://go-review.googlesource.com/c/152544

@mkumatag

This comment has been minimized.

Copy link

commented Feb 27, 2019

@sudeeshjohn sudeeshjohn changed the title Kubernetes building is failing runtime Kubernetes building is failing Feb 27, 2019

@agnivade agnivade changed the title Kubernetes building is failing cmd/compile: internal compiler error: unexpected Interface for <nil> while building Kubernetes Feb 27, 2019

@bradfitz

This comment has been minimized.

Copy link
Member

commented Feb 27, 2019

I can reproduce this on linux/amd64. It's not ppc64x-specific.

bradfitz@gdev:~/go/src$ go version
go version devel +43732816be Wed Feb 27 15:08:01 2019 +0000 linux/amd64

bradfitz@gdev:~/go/src$ go get -d -u k8s.io/kubernetes/test/e2e/storage 

bradfitz@gdev:~/src/k8s.io/kubernetes$ git show-ref HEAD
b2e9b2a842b72d3a19ad7e540d0589dd84722d2a refs/remotes/origin/HEAD

bradfitz@gdev:~/go/src$ go install k8s.io/kubernetes/test/e2e/storage 
# k8s.io/kubernetes/test/e2e/storage 
../../src/k8s.io/kubernetes/test/e2e/storage/pd.go:203:86: internal compiler error: unexpected Interface for <nil> 
 
goroutine 1 [running]: 
runtime/debug.Stack(0xf84980, 0xc00000e018, 0x0) 
        /home/bradfitz/go/src/runtime/debug/stack.go:24 +0x9d 
cmd/compile/internal/gc.Fatalf(0xde10d3, 0x1b, 0xc001c4a558, 0x1, 0x1) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/subr.go:190 +0x293 
cmd/compile/internal/gc.Val.Interface(0x0, 0x0, 0xc000038380, 0x7f6d4ce326d0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/const.go:98 +0x27e 
cmd/compile/internal/gc.(*constSet).add(0xc001c4a7b0, 0xc001189590, 0xdd133c) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/const.go:1477 +0x109 
cmd/compile/internal/gc.typecheckcomplit(0xc00118ea00, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:3089 +0xbf2 
cmd/compile/internal/gc.typecheck1(0xc00118ea00, 0x2, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:902 +0x46f8 
cmd/compile/internal/gc.typecheck(0xc00118ea00, 0x2, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6f2 
cmd/compile/internal/gc.typecheckslice(0xc0006e6de0, 0x4, 0x4, 0x2) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x50 
cmd/compile/internal/gc.typecheck1(0xc00118e900, 0x1, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:1324 +0x3759 
cmd/compile/internal/gc.typecheck(0xc00118e900, 0x1, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6f2 
cmd/compile/internal/gc.typecheckslice(0xc0002e6340, 0x6, 0x8, 0x1) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x50 
cmd/compile/internal/gc.typecheck1(0xc00118e200, 0x1, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:2148 +0xac27 
cmd/compile/internal/gc.typecheck(0xc00118e200, 0x1, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6f2 
cmd/compile/internal/gc.typecheckslice(0xc0002fe800, 0x23, 0x40, 0x1) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x50 
cmd/compile/internal/gc.typecheckclosure(0xc000b05340, 0x2) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/closure.go:111 +0x2da 
cmd/compile/internal/gc.typecheck1(0xc000b05340, 0x2, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:2017 +0x42d5 
cmd/compile/internal/gc.typecheck(0xc000b05340, 0x2, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6f2 
cmd/compile/internal/gc.typecheckslice(0xc000609860, 0x2, 0x2, 0x2) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x50 
cmd/compile/internal/gc.typecheck1(0xc001186700, 0x1, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:1324 +0x3759 
cmd/compile/internal/gc.typecheck(0xc001186700, 0x1, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6f2 
cmd/compile/internal/gc.typecheckslice(0xc0006fbb20, 0x4, 0x4, 0x1) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x50 
cmd/compile/internal/gc.typecheckrange(0xc001186100) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/range.go:36 +0x11e 
cmd/compile/internal/gc.typecheck1(0xc001186100, 0x1, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:2181 +0xadbc 
cmd/compile/internal/gc.typecheck(0xc001186100, 0x1, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6f2 
cmd/compile/internal/gc.typecheckslice(0xc0005737c0, 0x7, 0x8, 0x1) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x50 
cmd/compile/internal/gc.typecheckclosure(0xc000b05080, 0x2) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/closure.go:111 +0x2da 
cmd/compile/internal/gc.typecheck1(0xc000b05080, 0x2, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:2017 +0x42d5 
cmd/compile/internal/gc.typecheck(0xc000b05080, 0x2, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6f2 
cmd/compile/internal/gc.typecheckslice(0xc000609870, 0x2, 0x2, 0x2) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x50 
cmd/compile/internal/gc.typecheck1(0xc000a41880, 0x1, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:1324 +0x3759 
cmd/compile/internal/gc.typecheck(0xc000a41880, 0x1, 0x0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:298 +0x6f2 
cmd/compile/internal/gc.typecheckslice(0xc001184000, 0x14, 0x1c, 0x1) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/typecheck.go:116 +0x50 
cmd/compile/internal/gc.Main(0xdf62f0) 
        /home/bradfitz/go/src/cmd/compile/internal/gc/main.go:545 +0x2a54 
main.main() 
        /home/bradfitz/go/src/cmd/compile/main.go:51 +0xad 
@mdempsky

This comment has been minimized.

Copy link
Member

commented Feb 27, 2019

Able to reproduce. It seems like isGoConst is reporting true for non-const expressions.

@mdempsky

This comment has been minimized.

Copy link
Member

commented Feb 28, 2019

Minimal repro:

package p

func f() {
	var s string
	_ = map[string]string{s: ""}
}

const s = ""
@mdempsky

This comment has been minimized.

Copy link
Member

commented Feb 28, 2019

For some reason n.isGoConst() is evaluating to true for s when looking at the map literal, even though the s that's in context there is not a constant.

@griesemer will be amused to know we're still dealing with problems with lexical scoping. ;[

@gopherbot

This comment has been minimized.

Copy link

commented Feb 28, 2019

Change https://golang.org/cl/164319 mentions this issue: cmd/compile: fix false positives in isGoConst

@gopherbot gopherbot closed this in 7fa195c Feb 28, 2019

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.