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: failed to build go.elastic.co/go-licence-detector #44335

Closed
johejo opened this issue Feb 17, 2021 · 4 comments
Closed

cmd/compile: failed to build go.elastic.co/go-licence-detector #44335

johejo opened this issue Feb 17, 2021 · 4 comments
Assignees
Milestone

Comments

@johejo
Copy link

@johejo johejo commented Feb 17, 2021

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

$ go version
go version devel +2f0da6d9e2 Wed Feb 17 01:29:54 2021 +0000 linux/amd64

Does this issue reproduce with the latest release?

No.
There is no problem with go1.16.0 and go1.15.8.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/heijo/.cache/go-build"
GOENV="/home/heijo/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/heijo/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/heijo/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/heijo/ghq/go.googlesource.com/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/heijo/ghq/go.googlesource.com/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel +2f0da6d9e2 Wed Feb 17 01:29:54 2021 +0000"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/heijo/ghq/github.com/elastic/go-licence-detector/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build3807889825=/tmp/go-build -gno-record-gcc-switches"

What did you do?

git clone https://github.com/elastic/go-licence-detector.git
cd go-license-detector/
go build ./...

What did you expect to see?

Build succeeds

What did you see instead?

# go.elastic.co/go-licence-detector/detector
detector/detector.go:90:81: internal compiler error: 'newClassiferFromEmbeddedDB.func2': Value live at entry. It shouldn't be. func newClassiferFromEmbeddedDB.func2, node licenseclassifier.b, value nil

goroutine 76 [running]:
runtime/debug.Stack(0xe9d600, 0xc00000e018, 0x0)
        /home/heijo/ghq/go.googlesource.com/go/src/runtime/debug/stack.go:24 +0x9f
cmd/compile/internal/base.FatalfAt(0x640f000000059, 0xc002e0c8c0, 0x46, 0xc0004a0f00, 0x4, 0x4)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/base/print.go:227 +0x1bc
cmd/compile/internal/base.Fatalf(...)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/ssagen.(*ssafn).Fatalf(0xc003a14b70, 0x640f000000059, 0xd84d8e, 0x40, 0xc003a14d20, 0x3, 0x3)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/ssagen/ssa.go:7210 +0x1a7
cmd/compile/internal/ssagen.(*state).Fatalf(...)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/ssagen/ssa.go:845
cmd/compile/internal/ssagen.(*state).variable(0xc002e7e700, 0xeacdc0, 0xc0011bb520, 0xc00042b860, 0xc002012e40)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/ssagen/ssa.go:6213 +0x3b5
cmd/compile/internal/ssagen.(*state).expr(0xc002e7e700, 0xeacdc0, 0xc0011bb520, 0x0)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/ssagen/ssa.go:2297 +0x3b1f
cmd/compile/internal/ssagen.(*state).stmt(0xc002e7e700, 0xeab650, 0xc0013dcb90)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/ssagen/ssa.go:1498 +0x2ae
cmd/compile/internal/ssagen.(*state).stmtList(0xc002e7e700, 0xc0013c0180, 0x1, 0x1)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/ssagen/ssa.go:1269 +0x68
cmd/compile/internal/ssagen.(*state).stmt(0xc002e7e700, 0xeab8a8, 0xc0013cea00)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/ssagen/ssa.go:1292 +0x1689
cmd/compile/internal/ssagen.(*state).stmtList(0xc002e7e700, 0xc0013cea80, 0x3, 0x4)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/ssagen/ssa.go:1269 +0x68
cmd/compile/internal/ssagen.(*state).stmt(0xc002e7e700, 0xeab650, 0xc0011bcbe0)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/ssagen/ssa.go:1287 +0xed
cmd/compile/internal/ssagen.(*state).stmtList(0xc002e7e700, 0xc0013d2160, 0x2, 0x2)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/ssagen/ssa.go:1269 +0x68
cmd/compile/internal/ssagen.buildssa(0xc0011b54a0, 0x1, 0x0)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/ssagen/ssa.go:522 +0x1145
cmd/compile/internal/ssagen.Compile(0xc0011b54a0, 0x1)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/ssagen/pgen.go:168 +0x5d
cmd/compile/internal/gc.compileFunctions.func2.1(0xc0000aa400, 0xc0011b54a0, 0xc0003e80a0, 0xc0003f2050)
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/gc/compile.go:127 +0x65
created by cmd/compile/internal/gc.compileFunctions.func2
        /home/heijo/ghq/go.googlesource.com/go/src/cmd/compile/internal/gc/compile.go:125 +0x8e
@tonyghita
Copy link

@tonyghita tonyghita commented Feb 17, 2021

I ran into an issue with a similar message and posted the results of git bisect on this issue: #44325 (comment)

The issue I ran into was introduced earlier than this issue.

Loading

@mdempsky
Copy link
Member

@mdempsky mdempsky commented Feb 18, 2021

Minimizing the crash, it comes down to this function in github.com/google/licenseclassifier:

func ArchiveBytes(b []byte) OptionFunc {
	return func(l *License) error {
		l.archive = func() ([]byte, error) { return b, nil }
		return nil
	}
}

This function looks really similar to the repro case in #44325, so I'm going to close as a duplicate for now.

/cc @danscales

Loading

@mdempsky mdempsky closed this Feb 18, 2021
@danscales danscales reopened this Feb 18, 2021
@danscales
Copy link

@danscales danscales commented Feb 18, 2021

I'm reopening, since #44325 contains two different issues, and this bug is representative of the second issue in the bug by rogpeppe:

=======

Here's a related example that produces a different compiler error:

cd p1
go install

-- go.mod --
module example

go 1.15
-- go.sum --
-- p1/f.go --
package metrics

import "example/p2"

func F() {
	p2.FM("")
}
-- p2/w.go --
package p2

type W struct {
	M func(string) string
}

func FM(m string) func(W) {
	return func(pw W) {
		pw.M = func(string) string {
			return m
		}
	}
}

From the above code I get this error:

> cd p1
$WORK/p1
> go install
[stderr]
# example/p1
./f.go:6:7: internal compiler error: 'F.func2': Value live at entry. It shouldn't be. func F.func2, node p2.m, value nil

goroutine 66 [running]:
runtime/debug.Stack(0xe9d640, 0xc00000e018, 0x0)
	/home/rogpeppe/go/src/runtime/debug/stack.go:24 +0x9f
cmd/compile/internal/base.FatalfAt(0x90a000000004, 0xc0007b0000, 0x46, 0xc000782300, 0x4, 0x4)
	/home/rogpeppe/go/src/cmd/compile/internal/base/print.go:227 +0x1bc
cmd/compile/internal/base.Fatalf(...)
	/home/rogpeppe/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/ssagen.(*ssafn).Fatalf(0xc000780150, 0x90a000000004, 0xd84d8e, 0x40, 0xc000780300, 0x3, 0x3)
	/home/rogpeppe/go/src/cmd/compile/internal/ssagen/ssa.go:7210 +0x1a7
cmd/compile/internal/ssagen.(*state).Fatalf(...)
	/home/rogpeppe/go/src/cmd/compile/internal/ssagen/ssa.go:845
cmd/compile/internal/ssagen.(*state).variable(0xc0007a6000, 0xeacd80, 0xc0003ad6c0, 0xc00005eea0, 0xc00008ee40)
	/home/rogpeppe/go/src/cmd/compile/internal/ssagentestscript: exit 1
/ssa.go:6213 +0x3b5
cmd/compile/internal/ssagen.(*state).expr(0xc0007a6000, 0xeacd80, 0xc0003ad6c0, 0x0)
	/home/rogpeppe/go/src/cmd/compile/internal/ssagen/ssa.go:2297 +0x3b1f
cmd/compile/internal/ssagen.(*state).stmt(0xc0007a6000, 0xeab610, 0xc000790550)
	/home/rogpeppe/go/src/cmd/compile/internal/ssagen/ssa.go:1498 +0x2ae
cmd/compile/internal/ssagen.(*state).stmtList(0xc0007a6000, 0xc000784120, 0x1, 0x1)
	/home/rogpeppe/go/src/cmd/compile/internal/ssagen/ssa.go:1269 +0x68
cmd/compile/internal/ssagen.(*state).stmt(0xc0007a6000, 0xeab868, 0xc000782240)
	/home/rogpeppe/go/src/cmd/compile/internal/ssagen/ssa.go:1292 +0x1689
cmd/compile/internal/ssagen.(*state).stmtList(0xc0007a6000, 0xc0007821c0, 0x4, 0x4)
	/home/rogpeppe/go/src/cmd/compile/internal/ssagen/ssa.go:1269 +0x68
cmd/compile/internal/ssagen.(*state).stmt(0xc0007a6000, 0xeab610, 0xc0003b6c80)
	/home/rogpeppe/go/src/cmd/compile/internal/ssagen/ssa.go:1287 +0xed
cmd/compile/internal/ssagen.(*state).stmtList(0xc0007a6000, 0xc000784090, 0x1, 0x1)
	/home/rogpeppe/go/src/cmd/compile/internal/ssagen/ssa.go:1269 +0x68
cmd/compile/internal/ssagen.buildssa(0xc00013a840, 0x0, 0x0)
	/home/rogpeppe/go/src/cmd/compile/internal/ssagen/ssa.go:522 +0x1145
cmd/compile/internal/ssagen.Compile(0xc00013a840, 0x0)
	/home/rogpeppe/go/src/cmd/compile/internal/ssagen/pgen.go:168 +0x5d
cmd/compile/internal/gc.compileFunctions.func2.1(0xc00079a000, 0xc00013a840, 0xc00078a050, 0xc00078c060)
	/home/rogpeppe/go/src/cmd/compile/internal/gc/compile.go:127 +0x65
created by cmd/compile/internal/gc.compileFunctions.func2
	/home/rogpeppe/go/src/cmd/compile/internal/gc/compile.go:125 +0x8e


[exit status 2]
FAIL: /tmp/testscript633248317/0/script.txt:2: unexpected go command failure
error running /tmp/export-bug.txt in /tmp/testscript633248317/0

Loading

@danscales danscales self-assigned this Feb 18, 2021
@danscales danscales added this to the Go1.17 milestone Feb 18, 2021
@gopherbot
Copy link

@gopherbot gopherbot commented Feb 19, 2021

Change https://golang.org/cl/294212 mentions this issue: cmd/compile: fix import of functions of multiple nested closure

Loading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants