Skip to content

cmd/gc: internal compiler error when inlining due to missing export data #5755

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

Closed
gopherbot opened this issue Jun 22, 2013 · 7 comments
Closed

Comments

@gopherbot
Copy link
Contributor

by [email protected]:

If possible, include a link to a program on play.golang.org.

1. go get code.google.com/p/go-imap/go1/imap; I tested with 1f4117c0b3da tip
2. go build http://play.golang.org/p/HzNEcD0_NJ


What is the expected output?

A compiled program. Perhaps error messages telling me what I did wrong.

What do you see instead?

stephen@hotel:~/sandbox/go/src/imaptest$ go build imapidle.go
# command-line-arguments
walk [7f5ba5365c90]
.   CALL l(15) tc(1)
.   .   NONAME-imap.plainAuth u(1) a(1) l(15) x(0+0) tc(1) imap.plainAuth G0
.   CALL-list
.   .   ADDSTR l(15) tc(1) string
.   .   .   ADDSTR l(15) tc(1) string
.   .   .   .   ADDSTR l(15) tc(1) string
.   .   .   .   .   ADDSTR l(15) tc(1) string
.   .   .   .   .   .   NAME-imap.identity·4 u(1) a(1) l(15) x(0+0) class(PAUTO) ld(1)
tc(1) used(1) string
.   .   .   .   .   .   LITERAL-"\x00" l(15) tc(1) string
.   .   .   .   .   NAME-imap.username·2 u(1) a(1) l(15) x(0+0) class(PAUTO) ld(1)
tc(1) used(1) string
.   .   .   .   LITERAL-"\x00" l(15) tc(1) string
.   .   .   NAME-imap.password·3 u(1) a(1) l(15) x(0+0) class(PAUTO) ld(1) tc(1)
used(1) string
./imapidle.go:4: undefined: imap.plainAuth
./imapidle.go:15: tempname called with nil type
./imapidle.go:15: internal compiler error: walkexpr: switch 1 unknown op CALL l(15) tc(1)


Which compiler are you using (5g, 6g, 8g, gccgo)?

6g

Which operating system are you using?

Debian Wheezy

Which version are you using?  (run 'go version')

go version go1.1 linux/amd64
devel +56909cb770fe Fri Jun 21 18:07:57 2013 -0700 (reported by mortdeus in #go-nuts)
@ality
Copy link
Member

ality commented Jun 23, 2013

Comment 1:

Here's a small reproducer:
# a.go
package a
type I interface { F() }
type foo []byte
func (f foo) F() { return }
func Test(s string) I { return foo(s) }
# main.go
package main
import "./a"
func main() {
    i := a.Test("frumious")
    _ = i
}
Which gives the same error:
rundir               bugs/tmp.go         : exit status 1
walk [7f5e0a643018]
.   CALL l(6) tc(1)
.   .   NONAME-a.foo u(1) a(1) l(6) x(0+0) tc(1) a.foo G0
.   CALL-list
.   .   NAME-a.s·2 u(1) a(1) l(6) x(0+0) class(PAUTO) ld(1) tc(1) used(1) string
/home/apm/src/go/test/bugs/tmp.dir/main.go:3: undefined: a.foo
/home/apm/src/go/test/bugs/tmp.dir/main.go:6: tempname called with nil type
/home/apm/src/go/test/bugs/tmp.dir/main.go:6: internal compiler error: walkexpr: switch
1 unknown op CALL l(6) tc(1)
exit status 1
Note that if you change the underlying type of a.foo to string instead of []byte
it works fine.

Labels changed: added go1.2, removed priority-triage.

Status changed to Accepted.

@ality
Copy link
Member

ality commented Jun 23, 2013

Comment 2:

A temporary workaround is to disable inlining (by building with -gcflags -l).

@remyoudompheng
Copy link
Contributor

Comment 3:

Sorry for that, I'll do a patch.

Status changed to Started.

@remyoudompheng
Copy link
Contributor

Comment 4:

Disabling inlining can be quite annoying performance-wise: another possible workaround
is to add a public variable "var Dummy foo" to force foo to be exported.

@ianlancetaylor
Copy link
Contributor

Comment 5:

Labels changed: added go1.1.2, removed go1.2.

@remyoudompheng
Copy link
Contributor

Comment 6:

This issue was closed by revision c1fc8d5.

Status changed to Fixed.

@adg
Copy link
Contributor

adg commented Jul 22, 2013

Comment 7:

This issue was closed by revision 7f7bdef7fc85.

@rsc rsc added this to the Go1.1.2 milestone Apr 14, 2015
@rsc rsc removed the go1.1.2 label Apr 14, 2015
adg added a commit that referenced this issue May 11, 2015
…n a few other cases.

««« CL 10464043 / c224c549a3c7
cmd/gc: fix missing export data for inlining in a few other cases.

Exported inlined functions that perform a string conversion
using a non-exported named type may miss it in export data.

Fixes #5755.

R=rsc, golang-dev, ality, r
CC=golang-dev
https://golang.org/cl/10464043
»»»

Update #5928

R=golang-dev, dave
CC=golang-dev
https://golang.org/cl/11629044
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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

6 participants