Skip to content

cmd/compile: infinite loop #48135

@reusee

Description

@reusee

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

$ go version
go version devel go1.18-df4c625d88 Thu Sep 2 01:06:17 2021 +0000 windows/amd64

Does this issue reproduce with the latest release?

No

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

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\reus\AppData\Local\go-build
set GOENV=C:\Users\reus\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\reus\go\pkg\mod
set GONOPROXY=github.com/reusee/*
set GONOSUMDB=github.com/reusee/*
set GOOS=windows
set GOPATH=C:\Users\reus\go
set GOPRIVATE=github.com/reusee/*
set GOPROXY=https://goproxy.cn,direct
set GOROOT=C:\Users\reus\gotip
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Users\reus\gotip\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=devel go1.18-df4c625d88 Thu Sep 2 01:06:17 2021 +0000
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\reus\AppData\Local\Temp\go-build699549376=/tmp/go-build -gno-record-gcc-switches
GOROOT/bin/go version: go version devel go1.18-df4c625d88 Thu Sep 2 01:06:17 2021 +0000 windows/amd64
GOROOT/bin/go tool compile -V: compile version devel go1.18-df4c625d88 Thu Sep 2 01:06:17 2021 +0000

What did you do?

package main

type Src[T any] func() Src[T]

func Foo[T any]() Src[T] {
        return nil
}

func main() {
        var _ Src[int] = Foo[int]
}

What did you expect to see?

Compile OK

What did you see instead?

# command-line-arguments
runtime: goroutine stack exceeds 1000000000-byte limit
runtime: sp=0xc020461428 stack=[0xc020460000, 0xc040460000]
fatal error: stack overflow

runtime stack:
runtime.throw({0x143863c, 0x1a3afc0})
        C:/Users/reus/gotip/src/runtime/panic.go:965 +0x76
runtime.newstack()
        C:/Users/reus/gotip/src/runtime/stack.go:1085 +0x5cc
runtime.morestack()
        C:/Users/reus/gotip/src/runtime/asm_amd64.s:422 +0x93

goroutine 1 [running]:
cmd/compile/internal/typecheck.(*Tsubster).typ1(0xc04045ecf0, 0xc0000a5420)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1021 +0x13e8 fp=0xc020461438 sp=0xc020461430 pc=0xd65088
cmd/compile/internal/typecheck.(*Tsubster).tstruct(0xc04045ecf0, 0xc0000a5650, 0x0)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1287 +0x15c fp=0xc0204614d8 sp=0xc020461438 pc=0xd651fc
cmd/compile/internal/typecheck.(*Tsubster).typ1(0xc04045ecf0, 0xc0000a5420)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1138 +0x1ad fp=0xc0204616e0 sp=0xc0204614d8 pc=0xd63e4d
cmd/compile/internal/typecheck.(*Tsubster).tstruct(0xc04045ecf0, 0xc0000a5650, 0x0)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1287 +0x15c fp=0xc020461780 sp=0xc0204616e0 pc=0xd651fc
cmd/compile/internal/typecheck.(*Tsubster).typ1(0xc04045ecf0, 0xc0000a5420)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1138 +0x1ad fp=0xc020461988 sp=0xc020461780 pc=0xd63e4d
cmd/compile/internal/typecheck.(*Tsubster).tstruct(0xc04045ecf0, 0xc0000a5650, 0x0)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1287 +0x15c fp=0xc020461a28 sp=0xc020461988 pc=0xd651fc
cmd/compile/internal/typecheck.(*Tsubster).typ1(0xc04045ecf0, 0xc0000a5420)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1138 +0x1ad fp=0xc020461c30 sp=0xc020461a28 pc=0xd63e4d
cmd/compile/internal/typecheck.(*Tsubster).tstruct(0xc04045ecf0, 0xc0000a5650, 0x0)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1287 +0x15c fp=0xc020461cd0 sp=0xc020461c30 pc=0xd651fc
cmd/compile/internal/typecheck.(*Tsubster).typ1(0xc04045ecf0, 0xc0000a5420)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1138 +0x1ad fp=0xc020461ed8 sp=0xc020461cd0 pc=0xd63e4d
cmd/compile/internal/typecheck.(*Tsubster).tstruct(0xc04045ecf0, 0xc0000a5650, 0x0)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1287 +0x15c fp=0xc020461f78 sp=0xc020461ed8 pc=0xd651fc
cmd/compile/internal/typecheck.(*Tsubster).typ1(0xc04045ecf0, 0xc0000a5420)

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions