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: internal compiler error for interface with cyclic result types #25851

Open
griesemer opened this issue Jun 12, 2018 · 1 comment

Comments

@griesemer
Copy link
Contributor

commented Jun 12, 2018

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:

  • go/types accepts this code (not clear that it should)
  • cmd/compile doesn't terminate (issue #25262)

cc: @thanm

@griesemer griesemer added this to the Gccgo milestone Jun 12, 2018

@thanm thanm assigned thanm and unassigned ianlancetaylor Jun 13, 2018

@thanm

This comment has been minimized.

Copy link
Member

commented Jun 13, 2018

This bug has the same failure mode as 25302 -- recursive cycle involving Interface_type::finish_backend_methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.