Closed
Description
The following program faults on ppc64le
http://play.golang.org/p/hRlQs7hss2
package main
type APIEndpoint struct {
Addresses []string
Hostnames []string
CACert string
EnvironUUID string
ServerUUID string
}
type Base struct {
name string
}
func (b *Base) ConnectionEndpoint() (APIEndpoint, error) {
return APIEndpoint{}, nil
}
type Super struct {
Base
}
type T interface {
ConnectionEndpoint() (APIEndpoint, error)
}
func main() {
var q T = new(Super)
q.ConnectionEndpoint()
}
% go run x.go
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x11208]
goroutine 1 [running]:
main.(*Super).ConnectionEndpoint(0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
<autogenerated>:1 +0x48
main.main()
/home/ubuntu/src/x/x.go:29 +0x9c
exit status 2
The program does not fault on any other architecture.
/cc @rsc @aclements @minux
Metadata
Metadata
Assignees
Type
Projects
Relationships
Development
No branches or pull requests
Activity
davecheney commentedon Aug 11, 2015
Reducing the size of
APIEndpoint
by arbitrarily commenting out fields makes the test pass once the struct is 8 words of less.davecheney commentedon Aug 11, 2015
Here is a shorter example
http://play.golang.org/p/PWbXrURQOD
davecheney commentedon Aug 11, 2015
It's duffzero
For some reason, when duffzero is required, it's being invoked twice.
davecheney commentedon Aug 11, 2015
Sorry. I think I was wrong about DUFFZERO. After looking at arm64 and amd64 output, this appears to be consistent, all archs' have this double duffzero pattern. However when duffzero is not present, no corruption appears.
mwhudson commentedon Aug 11, 2015
I see a problem in that: the tail call to the underlying method assumes that lr still points to the caller of the wrapper method, but the bl to duffzero stomps on that.
[-]cmd/compile: [/-][+]cmd/compile: DUFFZERO in autogenerated method corrupts LR[/+][-]cmd/compile: DUFFZERO in autogenerated method corrupts LR[/-][+]cmd/compile: DUFFZERO in autogenerated methods corrupts LR[/+]gopherbot commentedon Aug 11, 2015
CL https://golang.org/cl/13570 mentions this issue.
cmd/compile/internal/ppc64: disable DUFFZERO
cmd/compile/internal/ppc64: disable DUFFZERO
gopherbot commentedon Oct 6, 2015
CL https://golang.org/cl/14937 mentions this issue.
1 remaining item