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

cmd/compile: internal compiler error: expression has untyped type: #55297

Closed
AemonSwift opened this issue Sep 21, 2022 · 3 comments
Closed

cmd/compile: internal compiler error: expression has untyped type: #55297

AemonSwift opened this issue Sep 21, 2022 · 3 comments
Labels
compiler/runtime Issues related to the Go compiler and/or runtime.
Milestone

Comments

@AemonSwift
Copy link

AemonSwift commented Sep 21, 2022

internal compiler error: expression has untyped type:

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

$ go version
go version go1.19.1 darwin/arm64

Does this issue reproduce with the latest release?

yes

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="arm64"
GOBIN=""
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOOS="darwin"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.google.cn"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19.1"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/jw/zvq1_tb50_93d6qdvcm_2jph0000gn/T/go-build1146727949=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

func test[T string,R bool](a,b T ) R {
	return a>b
}
func main() {
        test[string,bool]("test1","test2")
}

What did you expect to see?

no compiler error

What did you see instead?

internal compiler error: expression has untyped type:
. GT untyped bool tc(1)
. . CALLFUNC Walked int tc(1)
. . . NAME-runtime.cmpstring Class:PFUNC Offset:0 Used FUNC-func(string, string) int tc(1)
. . CALLFUNC-Args
. . . NAME-main.a esc(no) Class:PPARAM DictIndex:1 Offset:0 OnStack Used go.shape.string_0 tc(1)
. . . NAME-main.b esc(no) Class:PPARAM DictIndex:1 Offset:0 OnStack Used go.shape.string_0 tc(1)
. . LITERAL-0 int tc(1)

@AemonSwift AemonSwift changed the title affected/package: go1.19.1 cmd/compile: internal compiler error: expression has untyped type: Sep 21, 2022
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Sep 21, 2022
@cuiweixie
Copy link
Contributor

cuiweixie commented Sep 21, 2022

master has fix this, may be need backport.

@cherrymui
Copy link
Member

cherrymui commented Sep 21, 2022

This works at tip, but fails with Go 1.18 and 1.19. I think we can close this.

cc @mdempsky @cuonglm for whether we could make it work for 1.19.

A workaround is to add explicit conversions, such as return R(bool(a > b))

@cherrymui cherrymui added this to the Go1.20 milestone Sep 21, 2022
@cuonglm
Copy link
Member

cuonglm commented Sep 21, 2022

I think this is a dup of #54537, not a regression, though, so not qualified for backport

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime.
Projects
None yet
Development

No branches or pull requests

5 participants