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: compiler crash in method finalization #21253

Closed
ianlancetaylor opened this issue Aug 1, 2017 · 3 comments
Closed

gccgo: compiler crash in method finalization #21253

ianlancetaylor opened this issue Aug 1, 2017 · 3 comments
Milestone

Comments

@ianlancetaylor
Copy link
Contributor

Current gccgo crashes on the following input file:

package p

type s1 struct {
	f m
	I
}

type m interface {
	Mm(*s2)
}

type s2 struct {
	*s1
}

type I interface {
	MI()
}

The crash looks like this:

go1: internal compiler error: in methods, at go/gofrontend/types.cc:8880
0x77910c Interface_type::methods() const
	../../gccgo3/gcc/go/gofrontend/types.cc:8880
0x794a47 Type::add_interface_methods_for_type(Type const*, Method::Field_indexes const*, unsigned int, Methods*)
	../../gccgo3/gcc/go/gofrontend/types.cc:11504
0x794fc2 Type::add_methods_for_type(Type const*, Method::Field_indexes const*, unsigned int, bool, bool, std::vector<Named_type const*, std::allocator<Named_type const*> >*, Methods*)
	../../gccgo3/gcc/go/gofrontend/types.cc:11373
0x794cc8 Type::add_embedded_methods_for_type(Type const*, Method::Field_indexes const*, unsigned int, bool, bool, std::vector<Named_type const*, std::allocator<Named_type const*> >*, Methods*)
	../../gccgo3/gcc/go/gofrontend/types.cc:11465
0x794f0e Type::add_methods_for_type(Type const*, Method::Field_indexes const*, unsigned int, bool, bool, std::vector<Named_type const*, std::allocator<Named_type const*> >*, Methods*)
	../../gccgo3/gcc/go/gofrontend/types.cc:11365
0x794cc8 Type::add_embedded_methods_for_type(Type const*, Method::Field_indexes const*, unsigned int, bool, bool, std::vector<Named_type const*, std::allocator<Named_type const*> >*, Methods*)
	../../gccgo3/gcc/go/gofrontend/types.cc:11465
0x794f0e Type::add_methods_for_type(Type const*, Method::Field_indexes const*, unsigned int, bool, bool, std::vector<Named_type const*, std::allocator<Named_type const*> >*, Methods*)
	../../gccgo3/gcc/go/gofrontend/types.cc:11365
0x7950ef Type::finalize_methods(Gogo*, Type const*, Location, Methods**)
	../../gccgo3/gcc/go/gofrontend/types.cc:11315
0x795443 Named_type::finalize_methods(Gogo*)
	../../gccgo3/gcc/go/gofrontend/types.cc:10307
0x70f354 Finalize_methods::type(Type*)
	../../gccgo3/gcc/go/gofrontend/gogo.cc:3079
0x777f42 Type::traverse(Type*, Traverse*)
	../../gccgo3/gcc/go/gofrontend/types.cc:290
0x77b09f Forward_declaration_type::do_traverse(Traverse*)
	../../gccgo3/gcc/go/gofrontend/types.cc:12371
0x777f5c Type::traverse(Type*, Traverse*)
	../../gccgo3/gcc/go/gofrontend/types.cc:298
0x777f5c Type::traverse(Type*, Traverse*)
	../../gccgo3/gcc/go/gofrontend/types.cc:298
0x77dd0d Typed_identifier_list::traverse(Traverse*)
	../../gccgo3/gcc/go/gofrontend/types.cc:12512
0x77dd70 Function_type::do_traverse(Traverse*)
	../../gccgo3/gcc/go/gofrontend/types.cc:4526
0x777f5c Type::traverse(Type*, Traverse*)
	../../gccgo3/gcc/go/gofrontend/types.cc:298
0x77dd0d Typed_identifier_list::traverse(Traverse*)
	../../gccgo3/gcc/go/gofrontend/types.cc:12512
0x777f5c Type::traverse(Type*, Traverse*)
	../../gccgo3/gcc/go/gofrontend/types.cc:298
0x70f2fc Finalize_methods::type(Type*)
	../../gccgo3/gcc/go/gofrontend/gogo.cc:3070
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
@ianlancetaylor ianlancetaylor added this to the Gccgo milestone Aug 1, 2017
@ianlancetaylor ianlancetaylor self-assigned this Aug 1, 2017
@trex58
Copy link

trex58 commented Aug 1, 2017

This happens when building Kubertenes 1.6.2 on Linux / x86_64 or PPC64LE.

@gopherbot
Copy link

Change https://golang.org/cl/52531 mentions this issue: test: add test that caused gccgo compiler crash

@gopherbot
Copy link

Change https://golang.org/cl/52570 mentions this issue: compiler: only finalize embedded fields before finalizing methods

hubot pushed a commit to gcc-mirror/gcc that referenced this issue Aug 2, 2017
    
    When finalizing the methods of a named struct type, we used to
    finalize all the field types first.  That can fail if the field types
    refer indirectly to the named type.  Change it to just finalize the
    embedded field types first, and the rest of the fields later.
    
    Fixes golang/go#21253
    
    Reviewed-on: https://go-review.googlesource.com/52570


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-7-branch@250833 138bc75d-0d04-0410-961f-82ee72b054a4
gopherbot pushed a commit that referenced this issue Aug 17, 2017
Updates #21253

Change-Id: Iece71a27207b578618cafb378dac2362517363d0
Reviewed-on: https://go-review.googlesource.com/52531
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@golang golang locked and limited conversation to collaborators Aug 2, 2018
asiekierka pushed a commit to WonderfulToolchain/gcc-ia16 that referenced this issue May 16, 2022
    
    When finalizing the methods of a named struct type, we used to
    finalize all the field types first.  That can fail if the field types
    refer indirectly to the named type.  Change it to just finalize the
    embedded field types first, and the rest of the fields later.
    
    Fixes golang/go#21253
    
    Reviewed-on: https://go-review.googlesource.com/52570

From-SVN: r250832
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants