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

cgo generates bad code for opaque structs #334

Closed
gopherbot opened this issue Nov 25, 2009 · 1 comment
Closed

cgo generates bad code for opaque structs #334

gopherbot opened this issue Nov 25, 2009 · 1 comment

Comments

@gopherbot
Copy link
Contributor

by tonygarnockjones:

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?

$ cat > problem.go <<EOF
package main

/*
typedef struct private_struct *private_struct_t;
private_struct_t m(void) { return (private_struct_t) 0; }
private_struct_t identity(private_struct_t arg) { return arg; }
*/
import "C"

func main() {
    s := C.m();
    s = C.identity(s);
}
EOF
$ cgo problem.go
$ tail -10 problem.cgo4.c 
void
_cgo_identity(void *v)
{
        struct {
                * p0;
                private_struct_t r;
        } *a = v;
        a->r = identity(a->p0);
}

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

The "p0" member of the anonymous struct in _cgo_identity should be of type
"private_struct_t".

What is your $GOOS?  $GOARCH?

darwin amd64

Which revision are you using?  (hg identify)

2b13a45c7c91 tip

Please provide any additional information below.
@rsc
Copy link
Contributor

rsc commented Nov 30, 2009

Comment 1:

This issue was closed by revision 354b100.

Status changed to Fixed.

Merged into issue #-.

@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

2 participants