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 error in type_index, export.cc:1265, non-local constant #34852

Closed
thanm opened this issue Oct 11, 2019 · 2 comments
Closed

gccgo: internal error in type_index, export.cc:1265, non-local constant #34852

thanm opened this issue Oct 11, 2019 · 2 comments
Milestone

Comments

@thanm
Copy link
Contributor

thanm commented Oct 11, 2019

What version of Go are you using (go version)?

gccgo tip

$ go version
go version go1.13 gccgo (GCC) 10.0.0 20191007 (experimental) linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

linux/amd64

What did you do?

Compile these two packages:

Package "a":

package a

type AI interface {
	bar()
}

type AC int

func (ab AC) bar() {
}

const (
	ACC = AC(101)
)

Package "b":

package b

import "a"

func Func() a.AI {
	return a.ACC
}

What did you expect to see?

clean build

What did you see instead?

Compile assert of the form

go1: internal compiler error: in type_index, at go/gofrontend/export.cc:1277
0x852f05 Export::type_index(Type const*)
	../../gcc-trunk/gcc/go/gofrontend/export.cc:1277
0x852fdd Export::write_type_to(Type const*, Export_function_body*)
	../../gcc-trunk/gcc/go/gofrontend/export.cc:1299
0x8641f3 Export_function_body::write_type(Type const*)
	../../gcc-trunk/gcc/go/gofrontend/export.h:345
0x8641f3 Integer_expression::do_export(Export_function_body*) const
	../../gcc-trunk/gcc/go/gofrontend/expressions.cc:2531
0x85f9f1 Expression::export_expression(Export_function_body*) const
	../../gcc-trunk/gcc/go/gofrontend/expressions.h:1059
0x85f9f1 Type_conversion_expression::do_export(Export_function_body*) const
...

This is problem very similar to issue 34577, except that in this case the constant is non-local instead of local. I think if I had been a little bit more imaginative in writing my testcase I could have caught it before.

@thanm thanm added this to the Gccgo milestone Oct 11, 2019
@thanm thanm self-assigned this Oct 11, 2019
@gopherbot
Copy link

Change https://golang.org/cl/201017 mentions this issue: test: revise testcase for new gccgo compiler bug

@gopherbot
Copy link

Change https://golang.org/cl/201018 mentions this issue: compiler: revise fix for including constant types during export processing

gopherbot pushed a commit that referenced this issue Oct 14, 2019
Add to the testcase originally created for issue 34577 so
as to also trigger the error condition for issue 34852 (the
two bugs are closely related).

Updates #34577.
Updates #34852.

Change-Id: I2347369652ce500184347606b2bb3e76d802b204
Reviewed-on: https://go-review.googlesource.com/c/go/+/201017
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
jpf91 pushed a commit to D-Programming-GDC/gcc that referenced this issue Oct 15, 2019
    
    This patch is an addendum to the fix for issue 34577, which was not
    sufficiently general. During export data processing, when looking at
    the types of constants mentioned in inlinable function bodies, include
    both locally defined constants and constant imported from other
    packages.
    
    Testcase for this bug is in CL 201017.
    
    Fixes golang/go#34852.
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/201018


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@276976 138bc75d-0d04-0410-961f-82ee72b054a4
emsr pushed a commit to emsr/gcc that referenced this issue Nov 2, 2019
    
    This patch is an addendum to the fix for issue 34577, which was not
    sufficiently general. During export data processing, when looking at
    the types of constants mentioned in inlinable function bodies, include
    both locally defined constants and constant imported from other
    packages.
    
    Testcase for this bug is in CL 201017.
    
    Fixes golang/go#34852.
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/201018


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@276976 138bc75d-0d04-0410-961f-82ee72b054a4
@golang golang locked and limited conversation to collaborators Oct 13, 2020
asiekierka pushed a commit to WonderfulToolchain/gcc-ia16 that referenced this issue May 16, 2022
    
    This patch is an addendum to the fix for issue 34577, which was not
    sufficiently general. During export data processing, when looking at
    the types of constants mentioned in inlinable function bodies, include
    both locally defined constants and constant imported from other
    packages.
    
    Testcase for this bug is in CL 201017.
    
    Fixes golang/go#34852.
    
    Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/201018

From-SVN: r276976
@rsc rsc unassigned thanm Jun 23, 2022
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

2 participants