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: in struct_field_expression #23870

Closed
ALTree opened this issue Feb 16, 2018 · 3 comments
Closed

gccgo: internal compiler error: in struct_field_expression #23870

ALTree opened this issue Feb 16, 2018 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Feb 16, 2018

The following program (reduced from a gosmith-generated one)

package p

var F func() [0]struct{
	A int 
}

var i int
var V = (F()[i]).A

crashes gccgo (GCC) 8.0.1 20180205 (experimental) with the following error:

go1: internal compiler error: in struct_field_expression, at go/go-gcc.cc:1539
0x6e164b Gcc_backend::struct_field_expression(Bexpression*, unsigned long, Location)
	../../gcc-trunk/gcc/go/go-gcc.cc:1539
0x6b8a81 Field_reference_expression::do_get_backend(Translate_context*)
	../../gcc-trunk/gcc/go/gofrontend/expressions.cc:11778
0x6c839b Type_conversion_expression::do_get_backend(Translate_context*)
	../../gcc-trunk/gcc/go/gofrontend/expressions.cc:3542
0x6ef008 Variable::get_init(Gogo*, Named_object*)
	../../gcc-trunk/gcc/go/gofrontend/gogo.cc:6670
0x703979 Gogo::write_globals()
	../../gcc-trunk/gcc/go/gofrontend/gogo.cc:1377

This gcc trunk build includes the fix for #22305, which no longer causes a crash; so I believe this is not a dup of #22305.

@ALTree ALTree added this to the Gccgo milestone Feb 16, 2018
@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 13, 2021
@ALTree
Copy link
Member Author

ALTree commented Jul 13, 2021

(Still reproducible in gccgo 11.1)

@gopherbot
Copy link

Change https://go.dev/cl/417874 mentions this issue: test: add test that caused gccgo crash

@ianlancetaylor
Copy link
Contributor

I just committed a patch to fix this on GCC tip. This was a bug in the gofrontend's GCC interface. Thanks for reporting the problem.

xionghul pushed a commit to xionghul/gcc that referenced this issue Jul 16, 2022
Test case is https://go.dev/cl/417874.

Fixes golang/go#23870

	* go-gcc.cc (Gcc_backend::struct_field_expression): Handle a void
	expression, as for f().x where f returns a zero-sized type.
gopherbot pushed a commit that referenced this issue Aug 19, 2022
For #23870

Change-Id: I3bbe0f751254d1354a59a88b45e6f944c7a2fb4d
Reviewed-on: https://go-review.googlesource.com/c/go/+/417874
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
@golang golang locked and limited conversation to collaborators Jul 16, 2023
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