Skip to content

gccgo: internal compiler error for interface with cyclic result types #25851

@griesemer

Description

@griesemer

With

gccgo (google-gccgo-261288) 9.0.0 20180607 (experimental)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

the following program

$ cat x.go
package main

func main() {
}

type I interface {
	M1() interface {
		I
	}
	M2() interface {
		I
	}
}

type S struct{}

func (S) M1() interface{ I } {
	return nil
}

func (S) M2() interface{ I } {
	return nil
}

crashes the compiler:

$ gccgo x.go
gccgo: internal compiler error: Segmentation fault signal terminated program go1
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://go.ext.google.com/go/> for instructions.

The program compiles (somewhat surprisingly) without error if the struct definition is absent:

$ cat x.go
package main

func main() {
}

type I interface {
	M1() interface {
		I
	}
	M2() interface {
		I
	}
}

For the reference:

cc: @thanm

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions