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: miscompilation of anonymous, recursive interfaces appearing in separate compilation units #56059

Open
mdempsky opened this issue Oct 5, 2022 · 0 comments
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mdempsky
Copy link
Member

mdempsky commented Oct 5, 2022

Program below should run and exit silently, but gccgo it prints a failure. (It prints a failure with cmd/compile too, but cmd/compile fails in the single-package case even: #56057.)

$ go run -compiler=gccgo x.go
FAIL:
*interface { a.i }
*interface { b.i }

$ head -20 go.mod x.go a/a.go b/b.go
==> go.mod <==
module m

go 1.20

==> x.go <==
package main

import (
	"fmt"
	"m/a"
	"m/b"
)

func main() {
	if a.X != b.X {
		fmt.Printf("FAIL:\n%T\n%T\n", a.X, b.X)
	}
}

==> a/a.go <==
package a

type i interface{ M() interface{ i } }

var X interface{} = (*interface{ i })(nil)

==> b/b.go <==
package b

type i interface{ M() interface{ j } }
type j interface{ M() interface{ i } }

var X interface{} = (*interface{ i })(nil)

/cc @ianlancetaylor @griesemer

@mdempsky mdempsky added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 5, 2022
@mdempsky mdempsky added this to the Gccgo milestone Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

1 participant