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: panic with unreachable recover() #48459

Closed
mattn opened this issue Sep 18, 2021 · 1 comment
Closed

cmd/compile: panic with unreachable recover() #48459

mattn opened this issue Sep 18, 2021 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mattn
Copy link
Member

mattn commented Sep 18, 2021

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

$ go version
go version devel go1.18-c894b442d1 Sat Sep 18 06:04:41 2021 +0000 windows/amd64

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
set GO111MODULE=on
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\mattn\AppData\Local\go-build
set GOENV=C:\Users\mattn\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\mattn\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\mattn\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\dev\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\dev\go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=devel go1.18-c894b442d1 Sat Sep 18 06:04:41 2021 +0000
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\mattn\go\src\github.com\mattn\iii\go.mod
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\mattn\AppData\Local\Temp\go-build405125501=/tmp/go-build -gno-record-gcc-switches

What did you do?

package main

func main() {
	if true {
		return
	}

	defer func() {
		recover()
	}()
}

This is not reproduced on Go playground.

https://play.golang.org/p/gru0RzZcLGh

What did you expect to see?

Compilation successfully.

What did you see instead?

# command-line-arguments
.\main.go:9:10: internal compiler error: order.stmt recover

goroutine 1 [running]:
runtime/debug.Stack()
	C:/dev/go/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0xbf2078, 0x0}, {0xa8194d, 0xd}, {0xc00058d998, 0x1, 0x1})
	C:/dev/go/src/cmd/compile/internal/base/print.go:227 +0x154
cmd/compile/internal/base.Fatalf(...)
	C:/dev/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/walk.(*orderState).stmt(0xc000686040, {0xbf2078, 0xc000402090})
	C:/dev/go/src/cmd/compile/internal/walk/order.go:602 +0x281e
cmd/compile/internal/walk.(*orderState).stmtList(0xa4f5a0, {0xc00005e1b0, 0x1, 0x1})
	C:/dev/go/src/cmd/compile/internal/walk/order.go:397 +0x85
cmd/compile/internal/walk.orderBlock(0xc000074430, 0xc000696060)
	C:/dev/go/src/cmd/compile/internal/walk/order.go:460 +0x85
cmd/compile/internal/walk.order(0xc000074420)
	C:/dev/go/src/cmd/compile/internal/walk/order.go:66 +0x9b
cmd/compile/internal/walk.Walk(0xc000074420)
	C:/dev/go/src/cmd/compile/internal/walk/walk.go:27 +0x4d
cmd/compile/internal/gc.prepareFunc(0xc000074420)
	C:/dev/go/src/cmd/compile/internal/gc/compile.go:92 +0x6d
cmd/compile/internal/gc.enqueueFunc(0xc000074420)
	C:/dev/go/src/cmd/compile/internal/gc/compile.go:66 +0x2fd
cmd/compile/internal/gc.Main(0xaad238)
	C:/dev/go/src/cmd/compile/internal/gc/main.go:303 +0xe94
main.main()
	C:/dev/go/src/cmd/compile/main.go:55 +0xdd

@seankhliao seankhliao changed the title panic with unreachable recover() cmd/compile: panic with unreachable recover() Sep 18, 2021
@cuonglm cuonglm self-assigned this Sep 18, 2021
@cuonglm cuonglm added the NeedsFix The path to resolution is known, but the work has not been done. label Sep 18, 2021
@cuonglm cuonglm added this to the Go1.18 milestone Sep 18, 2021
@gopherbot
Copy link

Change https://golang.org/cl/350695 mentions this issue: cmd/compile: fix missing markHiddenClosureDead in deadcode pass

@rsc rsc unassigned cuonglm Jun 23, 2022
@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

3 participants