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 with simple recursive type declaration #25320

Closed
griesemer opened this issue May 9, 2018 · 1 comment
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@griesemer
Copy link
Contributor

$ gccgo --version
gccgo (google-gccgo-257955) 8.0.1 20180223 (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.
$ cat x.go
package main

type (
	A B
	B A
)

func main() {
}
$ gccgo x.go
go1: internal compiler error: in type, at go/gofrontend/types.cc:10253
0x730907 Find_type_use::type(Type*)
	/tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/types.cc:10253
0x722d62 Type::traverse(Type*, Traverse*)
	/tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/types.cc:318
0x728ef1 Named_type::do_verify()
	/tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/types.cc:10347
0x6ca82c Type::verify()
	/tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/types.h:564
0x6ca82c Verify_types::type(Type*)
	/tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/gogo.cc:2539
0x722d62 Type::traverse(Type*, Traverse*)
	/tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/types.cc:318
0x6d2010 Bindings::traverse(Traverse*, bool)
	/tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/gogo.cc:7950
0x6d24c1 Gogo::traverse(Traverse*)
	/tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/gogo.cc:2498
0x6d26a2 Gogo::verify_types()
	/tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/gogo.cc:2550
0x6ca087 go_parse_input_files(char const**, unsigned int, bool, bool)
	/tmp/go-build-release/gccgo-srcdir/gcc/go/gofrontend/go.cc:130
0x6c570f go_langhook_parse_file
	/tmp/go-build-release/gccgo-srcdir/gcc/go/go-lang.c:330
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://go.ext.google.com/go/> for instructions.

For the reference:
cmd/compile produces

x.go:4:2: invalid recursive type A
x.go:5:2: invalid recursive type B

go/types produces:

x.go:4:2: illegal cycle in declaration of A
x.go:4:2: 	A refers to
x.go:5:2: 	B refers to
x.go:4:2: 	A

cc: @thanm

@griesemer griesemer added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label May 9, 2018
@griesemer griesemer added this to the Gccgo milestone May 9, 2018
@gopherbot
Copy link

Change https://golang.org/cl/159837 mentions this issue: compiler: improve recursive type detection

kraj pushed a commit to kraj/gcc that referenced this issue Jan 29, 2019
    
    Detect recursive type definition like
    "type T0 T1; type T1 T2; ...... type Tn T0".
    
    Fixes golang/go#25320.
    
    Reviewed-on: https://go-review.googlesource.com/c/159837


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@268347 138bc75d-0d04-0410-961f-82ee72b054a4
@golang golang locked and limited conversation to collaborators Jan 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

3 participants