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: go1: internal compiler error: in type_index, at go/gofrontend/export.cc:1284 #51291

Closed
zhsj opened this issue Feb 21, 2022 · 2 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@zhsj
Copy link
Contributor

zhsj commented Feb 21, 2022

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

$ go version
go version go1.16.5 gccgo (Debian 11.2.0-16) 11.2.0 linux/amd64

Does this issue reproduce with the latest release?

Yes. Also verified with gcc snapshot 20220126.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/zhsj/.cache/go-build"
GOENV="/home/zhsj/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/zhsj/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/zhsj/go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/usr"
GOSUMDB="sum.golang.google.cn"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/gcc/x86_64-linux-gnu/11"
GOVCS=""
GOVERSION="go1.16.5 gccgo (Debian 11.2.0-16) 11.2.0"
GCCGO="/usr/bin/x86_64-linux-gnu-gccgo-11"
AR="ar"
CC="x86_64-linux-gnu-gcc-11"
CXX="x86_64-linux-gnu-g++-11"
CGO_ENABLED="1"
GOMOD="/tmp/t/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2634712924=/tmp/go-build -gno-record-gcc-switches -funwind-tables"

What did you do?

Build following code.

==> ./test.go <==
package t

import "t/t2"

type TypeA string

const StrA TypeA = TypeA(t2.StrB)

==> ./t2/test.go <==
package t2

type TypeB string

const StrB TypeB = "s"

==> ./go.mod <==
module t

go 1.16

What did you expect to see?

No error

What did you see instead?

go1: internal compiler error: in type_index, at go/gofrontend/export.cc:1284
0xd79611 internal_error(char const*, ...)
        ???:0
0xd768d0 fancy_abort(char const*, int, char const*)
        ???:0
0x1423cd2 Expression::export_constant_type(Export_function_body*, Type*)
        ???:0
0x1423db5 String_expression::do_export(Export_function_body*) const
        ???:0
0x1423fc7 Type_conversion_expression::do_export(Export_function_body*) const
        ???:0
0x1488c7a Named_constant::export_const(Export*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const
        ???:0
0x146e7e6 go_parse_input_files(char const**, unsigned int, bool, bool)
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-11/README.Bugs> for instructions.
@gopherbot gopherbot added this to the Gccgo milestone Feb 21, 2022
@ianlancetaylor ianlancetaylor added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 21, 2022
@ianlancetaylor ianlancetaylor self-assigned this Feb 21, 2022
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/405976 mentions this issue: compiler: traverse expressions when exporting constants

@gopherbot
Copy link
Contributor

Change https://go.dev/cl/406916 mentions this issue: test: add test that caused a gofrontend crash

gopherbot pushed a commit that referenced this issue May 18, 2022
For #51291

Change-Id: If47e4cbf899853ade5050852c3870b9500da4c63
Reviewed-on: https://go-review.googlesource.com/c/go/+/406916
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
xionghul pushed a commit to xionghul/gcc that referenced this issue May 19, 2022
When exporting a constant A that is expressed through a constant
B from another package, it is necessary to traverse an expression
representing the constant A to generate a sequence of type casts
from the constant B. Current implementation doesn't collect types
of constants contained in such expressions. This change fetches
these types.

Fixes golang/go#51291

Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/405976
realqhc pushed a commit to realqhc/gofrontend that referenced this issue Aug 4, 2022
When exporting a constant A that is expressed through a constant
B from another package, it is necessary to traverse an expression
representing the constant A to generate a sequence of type casts
from the constant B. Current implementation doesn't collect types
of constants contained in such expressions. This change fetches
these types.

Fixes golang/go#51291

Change-Id: I0f0922a4fa3dd82c18d8cfce7eb83ed98a642505
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/405976
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
@golang golang locked and limited conversation to collaborators Jun 22, 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