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: agen: unknown op CONV u(2) l(10) tc(1) implicit(1) #10219

Closed
omeid opened this issue Mar 23, 2015 · 5 comments
Milestone

Comments

@omeid
Copy link

omeid commented Mar 23, 2015

$ go version
go version go1.4.2 linux/amd64
$ uname -sorp
Linux 3.10.0-123.20.1.el7.x86_64 x86_64 GNU/Linux

How to reproduce:

cd $GOPATH/src && mkdir -p bug/{base,wrapper} && cd bug && echo 'package base

type message struct {
Command string
}

var pathMessage = struct {
message
Path    string
}{
message{"reload"},
"",
}

type Server struct{}

func (s *Server) SendPath(path string) {
r := pathMessage
r.Path = path
}
' > base/base.go && echo 'package wrapper

import (
    "bug/base"
)

func Start() *base.Server {
    return &base.Server{}
}
' > wrapper/wrapper.go; echo 'package bug

import (
    "bug/wrapper"
)

func test() {

    server := wrapper.Start()
    server.SendPath("test")

}
' > bug.go && go build

yields

./bug.go:4: cannot use base.pathMessage (type struct { base.message; Path string  }) as type struct { ? base.message; Path string } in assignment
./bug.go:10: internal compiler error: agen: unknown op CONV u(2) l(10) tc(1) implicit(1) STRUCT-struct { FIELD-@"bug/base".? base.message; FIELD-@"".Path string }
@omeid
Copy link
Author

omeid commented Mar 23, 2015

It is worth noting that package base and wrapper compiles just fine.

@ianlancetaylor ianlancetaylor changed the title internal compiler error: agen: unknown op CONV u(2) l(10) tc(1) implicit(1) cmd/gc: internal compiler error: agen: unknown op CONV u(2) l(10) tc(1) implicit(1) Mar 23, 2015
@ianlancetaylor ianlancetaylor added this to the Go1.5 milestone Mar 23, 2015
@ianlancetaylor
Copy link
Contributor

Still happens on tip.

@ianlancetaylor
Copy link
Contributor

This is a compiler crash on a valid program. The program builds successfully with gccgo. The bug appears to be related to inlining.

@ianlancetaylor ianlancetaylor modified the milestones: Go1.4.3, Go1.5 Mar 23, 2015
@josharian
Copy link
Contributor

Also reproduces with Go 1.3.3 and Go 1.2.2, so not a recent regression.

Here's a slightly smaller reproduction. The original error/report is F. There's also a different error message via G.

bug.go:

package bug

import "bug/wrapper"

func test() {
    wrapper.B.F()
    wrapper.B.G()
}

wrapper.go:

package wrapper

import "bug/base"

var B base.T

base.go:

package base

type str string

var m = struct{ str }{}

type T struct{}

func (T) F() {
    r := m
    _ = r
}

func (T) G() {
    r := struct{ str }{str("foo")}
    _ = r
}

omeid added a commit to omeid/go-livereload that referenced this issue Mar 25, 2015
@rsc rsc changed the title cmd/gc: internal compiler error: agen: unknown op CONV u(2) l(10) tc(1) implicit(1) cmd/compile: internal compiler error: agen: unknown op CONV u(2) l(10) tc(1) implicit(1) Jun 8, 2015
@ianlancetaylor ianlancetaylor modified the milestones: Go1.5, Go1.4.3 Jul 14, 2015
@gopherbot
Copy link

CL https://golang.org/cl/12241 mentions this issue.

@golang golang locked and limited conversation to collaborators Jul 18, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants