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

inlining bug: embedded fields of builtin type not recognized on import of inlined body #2687

Closed
alberts opened this issue Jan 12, 2012 · 7 comments

Comments

@alberts
Copy link
Contributor

alberts commented Jan 12, 2012

What steps will reproduce the problem?

tar -zxvf bork99.tar.gz
GCFLAGS= make nuke all
GCFLAGS=-l make nuke all

What is the expected output?

build success

What do you see instead?

error.go:5: unknown pb.errorCode field 'pb.error' in struct literal
error.go:19: tempname called with nil type

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

6g

Which operating system are you using?

linux

Which revision are you using?  (hg identify)

tip

Attachments:

  1. bork99.tar.gz (1366 bytes)
@alberts
Copy link
Contributor Author

alberts commented Jan 12, 2012

Comment 1:

You also need to build and install goprotobuf in $GOROOT before building bork99.

@bradfitz
Copy link
Contributor

Comment 2:

Owner changed to @lvdlvd.

Status changed to Accepted.

@lvdlvd
Copy link

lvdlvd commented Jan 12, 2012

Comment 3:

Status changed to Started.

@lvdlvd
Copy link

lvdlvd commented Jan 12, 2012

Comment 4:

narrowed it down to embedded fields of builtin types; inlineable bodies with structure
literals thereof
one.go:
package one
type T struct { int }
func New(i int) T { return T{i} }
two.go:
package two
import "./one"
func use() { _ = one.New(1) }
the problem is that on import
 func @"".New(@"".i int) (? @"".T) { return @"".T{ @"".int:@"".i } }
@"".int is not recognized as a builtin type.  looking at the best way to fix this now.

Labels changed: added priority-asap, compilerbug, removed priority-triage.

@lvdlvd
Copy link

lvdlvd commented Jan 12, 2012

Comment 5:

I'm not going to get this fixed before sleep, sorry.  I'll get to it first thing in the
morning.
If this is blocking you, as a quick workaround you can force any function in your case
error.go NewError, to be un-inlined by adding 
    for false {}  // force outlining
to it.  it saves you from having to fumble with the -l flag.

@lvdlvd
Copy link

lvdlvd commented Jan 18, 2012

Comment 6:

Fix pending in http://golang.org/cl/5545047/

@lvdlvd
Copy link

lvdlvd commented Jan 18, 2012

Comment 7:

This issue was closed by revision 6ff01f0.

Status changed to Fixed.

@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

4 participants