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: infinite loop in -G=3 type instantiation #48030

Closed
reusee opened this issue Aug 28, 2021 · 2 comments
Closed

cmd/compile: infinite loop in -G=3 type instantiation #48030

reusee opened this issue Aug 28, 2021 · 2 comments
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@reusee
Copy link

reusee commented Aug 28, 2021

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

$ go version
go version devel go1.18-ef4cb2f776 Sat Aug 28 01:26:53 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-ef4cb2f776 Sat Aug 28 01:26:53 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-build2762099682=/tmp/go-build -gno-record-gcc-switches
GOROOT/bin/go version: go version devel go1.18-ef4cb2f776 Sat Aug 28 01:26:53 2021 +0000 windows/amd64
GOROOT/bin/go tool compile -V: compile version devel go1.18-ef4cb2f776 Sat Aug 28 01:26:53 2021 +0000

What did you do?

package main

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

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

func main() {
        Seq[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=0xc020461440 stack=[0xc020460000, 0xc040460000]
fatal error: stack overflow

runtime stack:
runtime.throw({0x181c274, 0x1e1ee80})
        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(0xc04045efb0, 0xc000405420)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1014 +0x13e8 fp=0xc020461450 sp=0xc020461448 pc=0x1145f28
cmd/compile/internal/typecheck.(*Tsubster).tstruct(0xc04045efb0, 0xc0004056c0, 0x0)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1280 +0x15c fp=0xc0204614f0 sp=0xc020461450 pc=0x114609c
cmd/compile/internal/typecheck.(*Tsubster).typ1(0xc04045efb0, 0xc000405420)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1131 +0x1ad fp=0xc0204616f8 sp=0xc0204614f0 pc=0x1144ced
cmd/compile/internal/typecheck.(*Tsubster).tstruct(0xc04045efb0, 0xc0004056c0, 0x0)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1280 +0x15c fp=0xc020461798 sp=0xc0204616f8 pc=0x114609c
cmd/compile/internal/typecheck.(*Tsubster).typ1(0xc04045efb0, 0xc000405420)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1131 +0x1ad fp=0xc0204619a0 sp=0xc020461798 pc=0x1144ced
cmd/compile/internal/typecheck.(*Tsubster).tstruct(0xc04045efb0, 0xc0004056c0, 0x0)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1280 +0x15c fp=0xc020461a40 sp=0xc0204619a0 pc=0x114609c
cmd/compile/internal/typecheck.(*Tsubster).typ1(0xc04045efb0, 0xc000405420)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1131 +0x1ad fp=0xc020461c48 sp=0xc020461a40 pc=0x1144ced
cmd/compile/internal/typecheck.(*Tsubster).tstruct(0xc04045efb0, 0xc0004056c0, 0x0)
        C:/Users/reus/gotip/src/cmd/compile/internal/typecheck/subr.go:1280 +0x15c fp=0xc020461ce8 sp=0xc020461c48 pc=0x114609c
cmd/compile/internal/typecheck.(*Tsubster).typ1(0xc04045efb0, 0xc000405420)

@danscales

@cuonglm
Copy link
Member

cuonglm commented Aug 28, 2021

This works with GOEXPERIMENT=unified, cc @danscales @randall77

@danscales danscales self-assigned this Aug 28, 2021
@mdempsky mdempsky changed the title cmd/compile: infinite loop in type checker cmd/compile: infinite loop in -G=3 type instantiation Aug 29, 2021
@mdempsky mdempsky added the NeedsFix The path to resolution is known, but the work has not been done. label Aug 29, 2021
@mdempsky mdempsky added this to the Go1.18 milestone Aug 29, 2021
@gopherbot
Copy link

Change https://golang.org/cl/346229 mentions this issue: cmd/compile: fix bug with Inferred targs

@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

5 participants