Navigation Menu

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

gccgo: reflect assertion returning a struct value #6761

Closed
davecheney opened this issue Nov 14, 2013 · 5 comments
Closed

gccgo: reflect assertion returning a struct value #6761

davecheney opened this issue Nov 14, 2013 · 5 comments

Comments

@davecheney
Copy link
Contributor

What steps will reproduce the problem?

package main

import (
        "reflect"
)

type aStruct struct{}

func StructReturn() aStruct {
        return aStruct{}
}

func main() {
        f := reflect.ValueOf(StructReturn)
        f.Call([]reflect.Value{})
}

What is the expected output? What do you see instead?

% go run -compiler gc yy.go 

// works

% go run -compiler gccgo yy.go 
../../../gccgo/libgo/runtime/go-reflect-call.c:339: libgo assertion failure
Aborted

reflect.call
        ../../../gccgo/libgo/runtime/go-reflect-call.c:532
reflect.call.N13_reflect.Value
        ../../../gccgo/libgo/go/reflect/value.go:482
reflect.Call.N13_reflect.Value
        ../../../gccgo/libgo/go/reflect/value.go:341
main.main
        /home/dfc/src/yy.go:15
exit status 2

Please use labels and text to provide additional information.

 % gccgo -v
Using built-in specs.
COLLECT_GCC=gccgo
COLLECT_LTO_WRAPPER=/opt/gccgo/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gccgo/configure --prefix=/opt/gccgo --enable-languages=c,c++,go
--with-ld=/usr/bin/ld : (reconfigured) ../gccgo/configure --prefix=/opt/gccgo
--enable-languages=c,c++,go --with-ld=/usr/bin/ld
Thread model: posix
gcc version 4.9.0 20131109 (experimental) (GCC) 

Credit to Michael Hudson-Doyle for the test case.
@mwhudson
Copy link
Contributor

Comment 1:

Turns out this only happens with empty structs.  A special case is needed in
go-reflect-call.c.

@robpike
Copy link
Contributor

robpike commented Nov 18, 2013

Comment 2:

Labels changed: added priority-soon, removed priority-triage.

Owner changed to @paranoiacblack.

@ianlancetaylor
Copy link
Contributor

Comment 3:

Michael Hudson-Doyle has already sent in a CL for this.  I will commit it soon.  It was
just waiting on copyright paperwork.

Owner changed to @ianlancetaylor.

Status changed to Started.

@ianlancetaylor
Copy link
Contributor

Comment 4:

Fixed on tip.

Status changed to Fixed.

@bradfitz
Copy link
Contributor

Comment 5:

This issue was updated by revision 0a6ad46.

First contribution to Go, apologies in advance if I'm doing it wrong.
R=golang-dev, dave, minux.ma, iant, khr, bradfitz
CC=golang-dev
https://golang.org/cl/26570046
Committer: Brad Fitzpatrick 

@golang golang locked and limited conversation to collaborators Jun 25, 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