Skip to content

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

Closed

Description

@johejo

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

Activity

  1. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Feb 17, 2021
  2. tonyghita commented on Feb 17, 2021

    @tonyghita

    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.

  3. mdempsky commented on Feb 18, 2021

    @mdempsky
    Contributor

    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

  4. danscales commented on Feb 18, 2021

    @danscales
    Contributor

    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
    
  5. self-assigned this
    on Feb 18, 2021
  6. added this to the Go1.17 milestone on Feb 18, 2021
  7. gopherbot commented on Feb 19, 2021

    @gopherbot
    Contributor

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

  8. locked and limited conversation to collaborators on Feb 23, 2022
  9. added a commit that references this issue on Apr 29, 2024
    5f3dabb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions