Skip to content

cmd/compile: DUFFZERO in autogenerated methods corrupts LR #12108

@davecheney

Description

@davecheney

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

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions