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: [dev.regabi] various ICE and SIGSEGV after OCLOSURE export/import/inline CL #43818

Closed
zikaeroh opened this issue Jan 21, 2021 · 13 comments
Assignees
Labels
Milestone

Comments

@zikaeroh
Copy link
Contributor

@zikaeroh zikaeroh commented Jan 21, 2021

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

$ go version
go version devel +1760d736f6 Wed Jan 20 22:53:32 2021 +0000 linux/amd64

Does this issue reproduce with the latest release?

On dev.regabi.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jake/.cache/go-build"
GOENV="/home/jake/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/jake/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jake/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/jake/zikaeroh/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/jake/zikaeroh/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/jake/zikaeroh/hortbot/hortbot2/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-build094418326=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version devel +1760d736f6 Wed Jan 20 22:53:32 2021 +0000 linux/amd64
GOROOT/bin/go tool compile -V: compile version devel +1760d736f6 Wed Jan 20 22:53:32 2021 +0000
uname -sr: Linux 5.10.8-zen1-1-zen
/usr/lib/libc.so.6: GNU C Library (GNU libc) release release version 2.32.
gdb --version: GNU gdb (GDB) 10.1

What did you do?

Was curious to see how the new inlining code would affect my code, so I built dev.regabi and did a go build in my repo.

What did you expect to see?

Successfully compiling code I can benchmark.

What did you see instead?

ICEs and nil pointer derefs. Packages that repro this are listed in the logs (github.com/robfig/cron/v3, github.com/go-chi/chi/middleware are the smaller ones).

# github.com/hortbot/hortbot/internal/cli/subcommands/graphql
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5eff05]

goroutine 1 [running]:
cmd/compile/internal/ir.(*Name).Op(0x0, 0x5beeb5)
	<autogenerated>:1 +0x5
cmd/compile/internal/ir.HasUniquePos(0xea39c0, 0x0, 0xc000992801)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/ir/node.go:506 +0x35
cmd/compile/internal/ir.SetPos(0xea39c0, 0x0, 0xea39c0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/ir/node.go:527 +0x65
cmd/compile/internal/typecheck.typecheck(0xea39c0, 0x0, 0x2, 0xea39c0, 0xc00098fc70)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/typecheck.go:288 +0x66
cmd/compile/internal/typecheck.Expr(...)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/typecheck.go:32
cmd/compile/internal/typecheck.tcClosure(0xc0009987d0, 0x2)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/func.go:341 +0x188
cmd/compile/internal/typecheck.typecheck1(0xea2890, 0xc0009987d0, 0x2, 0xc0009987d0, 0xc0005b23e0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/typecheck.go:770 +0x19e7
cmd/compile/internal/typecheck.typecheck(0xea2890, 0xc0009987d0, 0x2, 0x4, 0xc0006c4b80)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/typecheck.go:371 +0xab9
cmd/compile/internal/typecheck.Expr(...)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/typecheck.go:32
cmd/compile/internal/inline.(*inlsubst).closure(0xc000997440, 0xc000998140, 0xc00098f520, 0xc000499bf0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:1248 +0xad3
cmd/compile/internal/inline.(*inlsubst).node(0xc000997440, 0xea2890, 0xc000998140, 0xea39c0, 0xc00099a0d0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:1368 +0x14c5
cmd/compile/internal/ir.(*AssignStmt).editChildren(0xc000998780, 0xc00055dd20)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/ir/node_gen.go:163 +0x8f
cmd/compile/internal/ir.EditChildren(...)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/ir/visit.go:185
cmd/compile/internal/inline.(*inlsubst).node(0xc000997440, 0xea2250, 0xc000998190, 0xea2250, 0xc000998730)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:1374 +0x9e3
cmd/compile/internal/inline.(*inlsubst).list(0xc000997440, 0xc0006c4a00, 0x4, 0x4, 0x1, 0xc00055f680, 0x1)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:1097 +0xbb
cmd/compile/internal/inline.(*inlsubst).closure(0xc000997440, 0xc0009982d0, 0xc00055dce0, 0x645e80)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:1230 +0x8e8
cmd/compile/internal/inline.(*inlsubst).node(0xc000997440, 0xea2890, 0xc0009982d0, 0xc00055dd50, 0xc00055dd40)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:1368 +0x14c5
cmd/compile/internal/inline.(*inlsubst).list(0xc000997440, 0xc00055dc70, 0x1, 0x1, 0x1, 0x1, 0x0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:1097 +0xbb
cmd/compile/internal/inline.(*inlsubst).node(0xc000997440, 0xea3e70, 0xc000998320, 0xc00055dd30, 0x10)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:1330 +0x2fd
cmd/compile/internal/inline.(*inlsubst).list(0xc000997440, 0xc00055dc80, 0x1, 0x1, 0x1, 0x1, 0x1)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:1097 +0xbb
cmd/compile/internal/inline.mkinlcall(0xc000396b00, 0xc00097a9a0, 0xc000000050, 0xc00072a000, 0xc000965a80, 0x0, 0x0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:982 +0x1e89
cmd/compile/internal/inline.inlnode(0xea2638, 0xc000396b00, 0x50, 0xc00072a000, 0xc000965a80, 0xea2c78, 0xc000128a38)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:633 +0x607
cmd/compile/internal/inline.InlineCalls.func1(0xea2638, 0xc000396b00, 0xc000000050, 0xc00072a000)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:520 +0x51
cmd/compile/internal/ir.editNodes(0xc000119100, 0x1, 0x1, 0xc000965a80)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/ir/node_gen.go:1427 +0x76
cmd/compile/internal/ir.(*CallExpr).editChildren(0xc000396bb0, 0xc000965a80)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/ir/node_gen.go:280 +0x92
cmd/compile/internal/ir.EditChildren(...)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/ir/visit.go:185
cmd/compile/internal/inline.inlnode(0xea2638, 0xc000396bb0, 0x50, 0xc00072a000, 0xc000965a80, 0xea2250, 0xc0004b0be0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:599 +0x206
cmd/compile/internal/inline.InlineCalls.func1(0xea2638, 0xc000396bb0, 0xc0004b0be0, 0xea2250)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:520 +0x51
cmd/compile/internal/ir.editNodes(0xc00039c800, 0x13, 0x20, 0xc000965a80)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/ir/node_gen.go:1427 +0x76
cmd/compile/internal/ir.(*Func).editChildren(0xc000178580, 0xc000965a80)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/ir/func.go:134 +0x4b
cmd/compile/internal/ir.EditChildren(...)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/ir/visit.go:185
cmd/compile/internal/inline.InlineCalls(0xc000178580)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:522 +0xed
cmd/compile/internal/inline.InlinePackage.func1(0xc00055d2a0, 0x2, 0x2, 0xc000166600)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:72 +0x76
cmd/compile/internal/ir.(*bottomUpVisitor).visit(0xc000957e00, 0xc000178580, 0xc000000004)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/ir/scc.go:128 +0x2f7
cmd/compile/internal/ir.VisitFuncsBottomUp(0xc000140500, 0x7, 0xa, 0xd840f8)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/ir/scc.go:60 +0x116
cmd/compile/internal/inline.InlinePackage()
	/home/jake/zikaeroh/go/src/cmd/compile/internal/inline/inl.go:59 +0x4f
cmd/compile/internal/gc.Main(0xd83fb8)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/main.go:225 +0x1305
main.main()
	/home/jake/zikaeroh/go/src/cmd/compile/main.go:54 +0xb1
# github.com/robfig/cron/v3
<autogenerated>:1: internal compiler error: cannot export SELRECV2 (102) node
	==> please file an issue and assign to gri@

goroutine 1 [running]:
runtime/debug.Stack(0xe944a0, 0xc00000e018, 0x0)
	/home/jake/zikaeroh/go/src/runtime/debug/stack.go:24 +0x9f
cmd/compile/internal/base.FatalfAt(0x100000000001, 0xd7d75e, 0x47, 0xc000f62c18, 0x2, 0x2)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/base/print.go:227 +0x1b9
cmd/compile/internal/base.Fatalf(...)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/typecheck.(*exportWriter).expr(0xc000dc2a10, 0xea20c0, 0xc0004a5ec0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1536 +0x655
cmd/compile/internal/typecheck.(*exportWriter).node(0xc000dc2a10, 0xea20c0, 0xc0004a5ec0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1073 +0xa5
cmd/compile/internal/typecheck.(*exportWriter).commList(0xc000dc2a10, 0xc000391d70, 0x2, 0x2)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1235 +0x99
cmd/compile/internal/typecheck.(*exportWriter).stmt(0xc000dc2a10, 0xea3f38, 0xc000442cb0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1182 +0xbb6
cmd/compile/internal/typecheck.(*exportWriter).node(0xc000dc2a10, 0xea3f38, 0xc000442cb0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1071 +0x78
cmd/compile/internal/typecheck.(*exportWriter).stmtList(0xc000dc2a10, 0xc000391d50, 0x1, 0x1)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1064 +0x6c
cmd/compile/internal/typecheck.(*exportWriter).expr(0xc000dc2a10, 0xea2890, 0xc0004a7c70)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1350 +0x3ca
cmd/compile/internal/typecheck.(*exportWriter).expr(0xc000dc2a10, 0xea2bb0, 0xc0004a7c20)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1435 +0xa7e
cmd/compile/internal/typecheck.(*exportWriter).expr(0xc000dc2a10, 0xea2bb0, 0xc0004a7bd0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1435 +0xa7e
cmd/compile/internal/typecheck.(*exportWriter).exprList(0xc000dc2a10, 0xc000391d30, 0x1, 0x1)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1242 +0x6c
cmd/compile/internal/typecheck.(*exportWriter).stmt(0xc000dc2a10, 0xea3e70, 0xc0004a7b80)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1141 +0xadc
cmd/compile/internal/typecheck.(*exportWriter).node(0xc000dc2a10, 0xea3e70, 0xc0004a7b80)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1071 +0x78
cmd/compile/internal/typecheck.(*exportWriter).stmtList(0xc000dc2a10, 0xc0003706c0, 0x4, 0x4)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1064 +0x6c
cmd/compile/internal/typecheck.(*exportWriter).expr(0xc000dc2a10, 0xea2890, 0xc0004a7a90)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1350 +0x3ca
cmd/compile/internal/typecheck.(*exportWriter).expr(0xc000dc2a10, 0xea2bb0, 0xc0004a7a40)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1435 +0xa7e
cmd/compile/internal/typecheck.(*exportWriter).exprList(0xc000dc2a10, 0xc000391cd0, 0x1, 0x1)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1242 +0x6c
cmd/compile/internal/typecheck.(*exportWriter).stmt(0xc000dc2a10, 0xea3e70, 0xc0004a79f0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1141 +0xadc
cmd/compile/internal/typecheck.(*exportWriter).node(0xc000dc2a10, 0xea3e70, 0xc0004a79f0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1071 +0x78
cmd/compile/internal/typecheck.(*exportWriter).stmtList(0xc000dc2a10, 0xc000391cb0, 0x1, 0x1)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1064 +0x6c
cmd/compile/internal/typecheck.(*exportWriter).funcBody(0xc000dc2a10, 0xc0000c1080)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:1059 +0x8b
cmd/compile/internal/typecheck.(*iexporter).doInline(0xc00008edc0, 0xc00036dc70)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:541 +0xd3
cmd/compile/internal/typecheck.(*exportWriter).funcExt(0xc000dc29a0, 0xc00036dc70)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:997 +0x1cf
cmd/compile/internal/typecheck.(*iexporter).doDecl(0xc00008edc0, 0xc00036dc70)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:458 +0x147
cmd/compile/internal/typecheck.WriteExports(0xc000b57a40)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/typecheck/iexport.go:274 +0x2a6
cmd/compile/internal/gc.dumpexport(0xc0009bbe30)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/export.go:34 +0x18c
cmd/compile/internal/gc.dumpCompilerObj(0xc0009bbe30)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/obj.go:106 +0x39
cmd/compile/internal/gc.dumpobj1(0x7ffd71d69ba7, 0x24, 0x3)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/obj.go:62 +0x174
cmd/compile/internal/gc.dumpobj()
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/obj.go:43 +0x50
cmd/compile/internal/gc.Main(0xd83fb8)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/main.go:299 +0xed4
main.main()
	/home/jake/zikaeroh/go/src/cmd/compile/main.go:54 +0xb1

# github.com/go-chi/chi/middleware
panic: interface conversion: interface {} is nil, not *escape.location

goroutine 1 [running]:
cmd/compile/internal/escape.(*batch).oldLoc(...)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:1298
cmd/compile/internal/escape.(*escape).exprSkipInit(0xc0005829a0, 0xc0010ed350, 0x0, 0x0, 0x0, 0xea39c0, 0xc0010cfe10)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:603 +0x2c05
cmd/compile/internal/escape.(*escape).expr(0xc0005829a0, 0xc0010ed350, 0x0, 0x0, 0x0, 0xea39c0, 0xc0010cfe10)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:566 +0x7e
cmd/compile/internal/escape.(*escape).call.func1(0xc0010ed350, 0x0, 0x0, 0x0, 0xea39c0, 0xc0010cfe10)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:990 +0x10a
cmd/compile/internal/escape.(*escape).call(0xc0005829a0, 0x0, 0x0, 0x0, 0xea2638, 0xc0010f44d0, 0x0, 0x0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:1036 +0x346
cmd/compile/internal/escape.(*escape).stmt(0xc0005829a0, 0xea2638, 0xc0010f44d0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:535 +0x1853
cmd/compile/internal/escape.(*escape).stmts(0xc0005829a0, 0xc000048660, 0x1, 0x1)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:548 +0x68
cmd/compile/internal/escape.(*escape).block(...)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:555
cmd/compile/internal/escape.(*escape).stmt(0xc0005829a0, 0xea3128, 0xc0010f8a80)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:429 +0x971
cmd/compile/internal/escape.(*escape).stmts(0xc0005829a0, 0xc001101720, 0x5, 0x5)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:548 +0x68
cmd/compile/internal/escape.(*escape).block(0xc0005829a0, 0xc001101720, 0x5, 0x5)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:555 +0x52
cmd/compile/internal/escape.(*batch).walkFunc(0xc0010ed320, 0xc0010f2420)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:307 +0xec
cmd/compile/internal/escape.(*escape).exprSkipInit(0xc0005827a0, 0xc0010f8f50, 0x0, 0x0, 0x0, 0xea2890, 0xc0011015e0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:784 +0x6f3
cmd/compile/internal/escape.(*escape).expr(0xc0005827a0, 0xc0010f8ee0, 0x0, 0x0, 0x0, 0xea2890, 0xc0011015e0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:566 +0x7e
cmd/compile/internal/escape.(*escape).exprSkipInit(0xc0005827a0, 0xc0010f8ee0, 0x0, 0x0, 0x0, 0xea2bb0, 0xc001101590)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:664 +0x10f7
cmd/compile/internal/escape.(*escape).expr(0xc0005827a0, 0xc0010f8ee0, 0x0, 0x0, 0x0, 0xea2bb0, 0xc001101590)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:566 +0x7e
cmd/compile/internal/escape.(*escape).exprSkipInit(0xc0005827a0, 0xc0010f8ee0, 0x0, 0x0, 0x0, 0xea2bb0, 0xc001101540)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:671 +0x1311
cmd/compile/internal/escape.(*escape).expr(0xc0005827a0, 0xc0010f8ee0, 0x0, 0x0, 0x0, 0xea2bb0, 0xc001101540)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:566 +0x7e
cmd/compile/internal/escape.(*escape).assignList(0xc0005827a0, 0xc000048600, 0x1, 0x1, 0xc000048610, 0x1, 0x1, 0xd5e6af, 0xb, 0xea20c0, ...)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:959 +0x238
cmd/compile/internal/escape.(*escape).stmt(0xc0005827a0, 0xea20c0, 0xc0011649c0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:508 +0x1478
cmd/compile/internal/escape.(*escape).stmts(0xc0005827a0, 0xc000582720, 0x2, 0x2)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:548 +0x68
cmd/compile/internal/escape.(*escape).stmt(0xc0005827a0, 0xea24a8, 0xc0000d0440)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:400 +0x11dd
cmd/compile/internal/escape.(*escape).stmts(0xc0005827a0, 0xc0000d04c0, 0x4, 0x4)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:548 +0x68
cmd/compile/internal/escape.(*escape).expr(0xc0005827a0, 0xc0010f8d90, 0x0, 0x0, 0x0, 0xea2bb0, 0xc0011019a0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:565 +0x48
cmd/compile/internal/escape.(*escape).assignList(0xc0005827a0, 0xc0000487d0, 0x1, 0x1, 0xc000048550, 0x1, 0x1, 0xd57df0, 0x6, 0xea3e70, ...)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:959 +0x238
cmd/compile/internal/escape.(*escape).stmt(0xc0005827a0, 0xea3e70, 0xc0011014a0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:533 +0x292
cmd/compile/internal/escape.(*escape).stmts(0xc0005827a0, 0xc0005823a0, 0x2, 0x2)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:548 +0x68
cmd/compile/internal/escape.(*escape).block(0xc0005827a0, 0xc0005823a0, 0x2, 0x2)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:555 +0x52
cmd/compile/internal/escape.(*batch).walkFunc(0xc0010ed320, 0xc0010f22c0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:307 +0xec
cmd/compile/internal/escape.Batch(0xc001151348, 0x1, 0x1, 0x0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/escape/escape.go:229 +0x232
cmd/compile/internal/reflectdata.methodWrapper(0xc001164600, 0xc000796820, 0x536301)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/reflectdata/reflect.go:1802 +0x7dd
cmd/compile/internal/reflectdata.methods(0xc001164600, 0x10, 0x10fa41f6, 0x4)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/reflectdata/reflect.go:353 +0x1e5
cmd/compile/internal/reflectdata.uncommonSize(...)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/reflectdata/reflect.go:82
cmd/compile/internal/reflectdata.dcommontype(0xc0010e7f80, 0xc001164600, 0xa8)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/reflectdata/reflect.go:719 +0x7c5
cmd/compile/internal/reflectdata.writeType(0xc001164600, 0xc001164600)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/reflectdata/reflect.go:1120 +0x9b3
cmd/compile/internal/reflectdata.dcommontype(0xc000c65980, 0xc000793a40, 0xc000793aa0)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/reflectdata/reflect.go:693 +0xac
cmd/compile/internal/reflectdata.writeType(0xc000793a40, 0xc00115b280)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/reflectdata/reflect.go:1074 +0x1676
cmd/compile/internal/reflectdata.WriteRuntimeTypes()
	/home/jake/zikaeroh/go/src/cmd/compile/internal/reflectdata/reflect.go:1312 +0x346
cmd/compile/internal/gc.dumpdata()
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/obj.go:117 +0x91
cmd/compile/internal/gc.Main(0xd83fb8)
	/home/jake/zikaeroh/go/src/cmd/compile/internal/gc/main.go:297 +0xebf
main.main()
	/home/jake/zikaeroh/go/src/cmd/compile/main.go:54 +0xb1

A bisect points to CL 283112, as expected.

/cc @danscales @mdempsky @randall77 (from the CL)

@zikaeroh zikaeroh changed the title cmd/compile: [dev.regabi] various ICE and SIGSEGV after late inline export CL cmd/compile: [dev.regabi] various ICE and SIGSEGV after inline export OCLOSURE CL Jan 21, 2021
@zikaeroh zikaeroh changed the title cmd/compile: [dev.regabi] various ICE and SIGSEGV after inline export OCLOSURE CL cmd/compile: [dev.regabi] various ICE and SIGSEGV after OCLOSURE export/import/inline CL Jan 21, 2021
@danscales danscales self-assigned this Jan 21, 2021
@danscales
Copy link

@danscales danscales commented Jan 21, 2021

Thanks, I think I may have already seen this when I lowered the inlining cost of functions with closures. But wanted to get the main change in, since it was stable and passing tests. Will fix this bug next.

Loading

@oiooj oiooj added the NeedsFix label Jan 21, 2021
@oiooj oiooj added this to the Go1.17 milestone Jan 21, 2021
@mdempsky
Copy link
Member

@mdempsky mdempsky commented Jan 21, 2021

# github.com/robfig/cron/v3
<autogenerated>:1: internal compiler error: cannot export SELRECV2 (102) node
	==> please file an issue and assign to gri@

I'm guessing this code has a function that contains a function literal that contains a select statement. We don't currently support inlining select statements, so we shouldn't consider the outer function inlinable either.

# github.com/go-chi/chi/middleware
panic: interface conversion: interface {} is nil, not *escape.location

This looks like Dcl or ClosureVars aren't correct for one of the functions. Either not matching the PAUTO/PPARAM/PPARAMOUT variables used within the function body, or the Defn/Outer for closure variables is mixed up.

Loading

@cuonglm
Copy link
Member

@cuonglm cuonglm commented Jan 22, 2021

Another ICE, which also breaks real code, but I made it smallest reproduce:

package main

import "github.com/soheilhy/cmux"

func main() {
	cmux.HTTP2HeaderField("content-type", "application/grpc")
}

which yields:

# command-line-arguments
./main.go:6:23: internal compiler error: 'main.func2': Value live at entry. It shouldn't be. func main.func2, node cmux.value, value nil

goroutine 21 [running]:
runtime/debug.Stack(0x102cf7f68, 0x140000ae008, 0x0)
	/Users/cuonglm/sources/go/src/runtime/debug/stack.go:24 +0x88
cmd/compile/internal/base.FatalfAt(0x9733000000008, 0x140000ee280, 0x46, 0x140003fe000, 0x4, 0x4)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/base/print.go:227 +0x18c
cmd/compile/internal/base.Fatalf(...)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/ssagen.(*ssafn).Fatalf(0x14000395d10, 0x9733000000008, 0x102b137f1, 0x40, 0x14000395f20, 0x3, 0x3)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/ssagen/ssa.go:7319 +0x160
cmd/compile/internal/ssagen.(*state).Fatalf(...)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/ssagen/ssa.go:844
cmd/compile/internal/ssagen.(*state).variable(0x140002f0400, 0x102d07380, 0x14000386f70, 0x140000b0e40, 0x14000094d68)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/ssagen/ssa.go:6325 +0x310
cmd/compile/internal/ssagen.(*state).expr(0x140002f0400, 0x102d07380, 0x14000386f70, 0x0)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/ssagen/ssa.go:2296 +0x300c
cmd/compile/internal/ssagen.(*state).stmt(0x140002f0400, 0x102d05c10, 0x140003c3310)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/ssagen/ssa.go:1497 +0x22c
cmd/compile/internal/ssagen.(*state).stmtList(0x140002f0400, 0x1400008f050, 0x1, 0x1)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/ssagen/ssa.go:1268 +0x68
cmd/compile/internal/ssagen.(*state).stmt(0x140002f0400, 0x102d05e68, 0x140000b3c80)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/ssagen/ssa.go:1291 +0x13c8
cmd/compile/internal/ssagen.(*state).stmtList(0x140002f0400, 0x140000b3cc0, 0x3, 0x4)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/ssagen/ssa.go:1268 +0x68
cmd/compile/internal/ssagen.(*state).stmt(0x140002f0400, 0x102d05c10, 0x140003c2f50)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/ssagen/ssa.go:1286 +0xc0
cmd/compile/internal/ssagen.(*state).stmtList(0x140002f0400, 0x140000b3b80, 0x3, 0x4)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/ssagen/ssa.go:1268 +0x68
cmd/compile/internal/ssagen.buildssa(0x140000f29a0, 0x0, 0x0)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/ssagen/ssa.go:521 +0xe84
cmd/compile/internal/ssagen.Compile(0x140000f29a0, 0x0)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/ssagen/pgen.go:168 +0x3c
cmd/compile/internal/gc.compileFunctions.func2.1(0x14000300310, 0x140000f29a0, 0x140000ae658, 0x140000b4b20)
	/Users/cuonglm/sources/go/src/cmd/compile/internal/gc/compile.go:127 +0x4c
created by cmd/compile/internal/gc.compileFunctions.func2
	/Users/cuonglm/sources/go/src/cmd/compile/internal/gc/compile.go:125 +0x7c

FAIL

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 22, 2021

Change https://golang.org/cl/285676 mentions this issue: [dev.regabi] cmd/compile: scan body of closure in tooHairy to check for disallowed nodes

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 22, 2021

Change https://golang.org/cl/285992 mentions this issue: [dev.typeparams] all: merge dev.regabi (7e0a81d) into dev.typeparams

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 23, 2021

Change https://golang.org/cl/285677 mentions this issue: [dev.regabi] cmd/compile: fix escape analysis problem with closures

Loading

gopherbot pushed a commit that referenced this issue Jan 23, 2021
…or disallowed nodes

Several of the bugs in #43818 are because we were not scanning the body
of an possibly inlined closure in tooHairy(). I think this scanning got
lost in the rebase past some of the ir changes. This fixes the issue
related to the SELRECV2 and the bug reported from cuonglm. There is at
least one other bug related to escape analysis which I'll fix in another
change.

Change-Id: I8f38cd12a287881155403bbabbc540ed5fc2248e
Reviewed-on: https://go-review.googlesource.com/c/go/+/285676
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
@zikaeroh
Copy link
Contributor Author

@zikaeroh zikaeroh commented Jan 23, 2021

FWIW, the first of the CLs (the tooHairy one) made my code compile and pass tests again.

The lack of tests in the CL is a little spooky, though... 🙂

Loading

gopherbot pushed a commit that referenced this issue Jan 23, 2021
As with CL 285875, this required resolving some conflicts around
handling of //go:embed directives. Still further work is needed to
reject uses of //go:embed in files that don't import "embed", so this
is left as a TODO. (When this code was written for dev.typeparams, we
were still leaning towards not requiring the "embed" import.)

Also, the recent support for inlining closures (CL 283112) interacts
poorly with -G=3 mode. There are some known issues with this code
already (#43818), so for now this CL disables inlining of closures
when in -G=3 mode with a TODO to revisit this once closure inlining is
working fully.

Conflicts:

- src/cmd/compile/internal/noder/noder.go
- src/cmd/compile/internal/typecheck/dcl.go
- src/cmd/compile/internal/typecheck/func.go
- test/run.go

Merge List:

+ 2021-01-22 7e0a81d [dev.regabi] all: merge master (dab3e5a) into dev.regabi
+ 2021-01-22 dab3e5a runtime: switch runtime to libc for openbsd/amd64
+ 2021-01-22 a1b53d8 cmd/go: add documentation for test and xtest fields output by go list
+ 2021-01-22 b268b60 runtime: remove pthread_kill/pthread_self for openbsd
+ 2021-01-22 ec40517 runtime: fix typo in mgcscavenge.go
+ 2021-01-22 7ece3a7 net/http: fix flaky TestDisableKeepAliveUpgrade
+ 2021-01-22 50cba05 time: clarify Timer.Reset behavior on AfterFunc Timers
+ 2021-01-22 cf10e69 doc/go1.16: mention net/http.Transport.GetProxyConnectHeader
+ 2021-01-22 ec1b945 doc/go1.16: mention path/filepath.WalkDir
+ 2021-01-22 11def3d doc/go1.16: mention syscall.AllThreadsSyscall
+ 2021-01-21 07b0235 doc/go1.16: add notes about package-specific fs.FS changes
+ 2021-01-21 e2b4f1f doc/go1.16: minor formatting fix
+ 2021-01-21 9f43a9e doc/go1.16: mention new debug/elf constants
+ 2021-01-21 3c2f11b cmd/go: overwrite program name with full path
+ 2021-01-21 953d1fe all: introduce and use internal/execabs
+ 2021-01-21 b186e4d cmd/go: add test case for cgo CC setting
+ 2021-01-21 5a8a226 cmd/cgo: report exec errors a bit more clearly
+ 2021-01-21 46e2e2e cmd/go: pass resolved CC, GCCGO to cgo
+ 2021-01-21 3d40895 runtime: switch openbsd/arm64 to pthreads
+ 2021-01-21 d95ca91 crypto/elliptic: fix P-224 field reduction
+ 2021-01-21 d7e71c0 [dev.regabi] cmd/compile: replace ir.Name map with ir.NameSet for dwarf
+ 2021-01-21 5248f59 [dev.regabi] cmd/compile: replace ir.Name map with ir.NameSet for SSA
+ 2021-01-21 970d8b6 [dev.regabi] cmd/compile: replace ir.Name map with ir.NameSet in inlining
+ 2021-01-21 68a4664 [dev.regabi] cmd/compile: remove tempAssigns in walkCall1
+ 2021-01-21 fd9a391 [dev.regabi] cmd/compile: remove CallExpr.Rargs
+ 2021-01-21 19a6db6 [dev.regabi] cmd/compile: make sure mkcall* passed non-nil init
+ 2021-01-21 9f03684 [dev.regabi] cmd/compile: use ir.DoChildren directly in inlining
+ 2021-01-21 213c390 [dev.regabi] cmd/compile: use node walked flag to prevent double walk for walkSelect
+ 2021-01-20 1760d73 [dev.regabi] cmd/compile: exporting, importing, and inlining functions with OCLOSURE
+ 2021-01-20 ecf4ebf cmd/internal/moddeps: check content of all modules in GOROOT
+ 2021-01-20 92cb157 [dev.regabi] cmd/compile: late expansion of return values
+ 2021-01-20 d2d155d runtime: don't adjust timer pp field in timerWaiting status
+ 2021-01-20 803d18f cmd/go: set Incomplete field on go list output if no files match embed
+ 2021-01-20 6e243ce cmd/go: have go mod vendor copy embedded files in subdirs
+ 2021-01-20 be28e5a cmd/go: fix mod_get_fallback test
+ 2021-01-20 928bda4 runtime: convert openbsd/amd64 locking to libc
+ 2021-01-19 824f2d6 cmd/go: allow go fmt to complete when embedded file is missing
+ 2021-01-19 0575e35 cmd/compile: require 'go 1.16' go.mod line for //go:embed
+ 2021-01-19 9423d50 [dev.regabi] cmd/compile: use '%q' for printing rune values less than 128
+ 2021-01-19 ccb2e90 cmd/link: exit before Asmb2 if error
+ 2021-01-19 ca5774a embed: treat uninitialized FS as empty
+ 2021-01-19 d047c91 cmd/link,runtime: switch openbsd/amd64 to pthreads
+ 2021-01-19 61debff runtime: factor out usesLibcall
+ 2021-01-19 9fed39d runtime: factor out mStackIsSystemAllocated
+ 2021-01-19 a2f825c [dev.regabi] cmd/compile: directly create go.map and go.track symbols
+ 2021-01-19 4a4212c [dev.regabi] cmd/compile: refactor Linksym creation
+ 2021-01-19 4f5c603 [dev.regabi] cmd/compile: cleanup callTargetLSym
+ 2021-01-18 dbab079 runtime: free Windows event handles after last lock is dropped
+ 2021-01-18 5a8fbb0 os: do not close syscall.Stdin in TestReadStdin
+ 2021-01-18 422f38f [dev.regabi] cmd/compile: move stack objects to liveness
+ 2021-01-18 6113db0 [dev.regabi] cmd/compile: convert OPANIC argument to interface{} during typecheck
+ 2021-01-18 4c835f9 [dev.regabi] cmd/compile: use LinksymOffsetExpr in TypePtr/ItabAddr
+ 2021-01-18 0ffa1ea [dev.regabi] cmd/compile: use *obj.LSym instead of *ir.Name for staticdata functions
+ 2021-01-17 7e0fa38 [dev.regabi] cmd/compile: remove unneeded packages from ir.Pkgs
+ 2021-01-17 99a5db1 [dev.regabi] cmd/compile: use LinksymOffsetExpr in walkConvInterface
+ 2021-01-17 87845d1 [dev.regabi] cmd/compile: add ir.TailCallStmt
+ 2021-01-17 e3027c6 [dev.regabi] cmd/compile: fix linux-amd64-noopt builder
+ 2021-01-17 59ff93f [dev.regabi] cmd/compile: rename NameOffsetExpr to LinksymOffsetExpr
+ 2021-01-17 82b9cae [dev.regabi] cmd/compile: change ir.NameOffsetExpr to use *obj.LSym instead of *Name
+ 2021-01-17 88956fc [dev.regabi] cmd/compile: stop analyze NameOffsetExpr.Name_ in escape analysis
+ 2021-01-17 7ce2a83 [dev.regabi] cmd/compile: simplify stack temp initialization
+ 2021-01-17 ba0e8a9 [dev.regabi] cmd/compile: refactor temp construction in walk
+ 2021-01-17 78e5aab [dev.regabi] cmd/compile: replace Node.HasCall with walk.mayCall
+ 2021-01-16 6de9423 [dev.regabi] cmd/compile: cleanup OAS2FUNC ordering
+ 2021-01-16 a956a0e [dev.regabi] cmd/compile, runtime: fix up comments/error messages from recent renames
+ 2021-01-16 ab3b67a [dev.regabi] cmd/compile: remove ONEWOBJ
+ 2021-01-16 c9b1445 [dev.regabi] cmd/compile: remove TypeAssertExpr {Src,Dst}Type fields
+ 2021-01-15 682a1d2 runtime: detect errors in DuplicateHandle
+ 2021-01-15 9f83418 cmd/link: remove GOROOT write in TestBuildForTvOS
+ 2021-01-15 ec94701 cmd/compile: allow embed into any string or byte slice type
+ 2021-01-15 54198b0 cmd/compile: disallow embed of var inside func
+ 2021-01-15 b386c73 cmd/go: fix go generate docs
+ 2021-01-15 bb5075a syscall: remove RtlGenRandom and move it into internal/syscall
+ 2021-01-15 1deae0b os: invoke processKiller synchronously in testKillProcess
+ 2021-01-15 03a8751 [dev.regabi] cmd/compile: unexport reflectdata.WriteType
+ 2021-01-15 14537e6 [dev.regabi] cmd/compile: move stkobj symbol generation to SSA
+ 2021-01-15 ab523fc [dev.regabi] cmd/compile: don't promote Byval CaptureVars if Addrtaken
+ 2021-01-15 ff196c3 crypto/x509: update iOS bundled roots to version 55188.40.9
+ 2021-01-15 b7a698c [dev.regabi] test: disable test on windows because expected contains path separators.
+ 2021-01-15 4be7af2 [dev.regabi] cmd/compile: fix ICE during ir.Dump
+ 2021-01-14 e125ccd cmd/go: in 'go mod edit', validate versions given to -retract and -exclude
+ 2021-01-14 eb33002 cmd/dist, cmd/go: pass -arch for C compilation on Darwin
+ 2021-01-14 84e8a06 cmd/cgo: remove unnecessary space in cgo export header
+ 2021-01-14 0c86b99 cmd/test2json: document passing -test.paniconexit0
+ 2021-01-14 9135795 cmd/go/internal/load: report positions for embed errors
+ 2021-01-14 35b9c66 [dev.regabi] cmd/compile,cmd/link: additional code review suggestions for CL 270863
+ 2021-01-14 d9b79e5 cmd/compile: fix wrong complement for arm64 floating-point comparisons
+ 2021-01-14 c73232d cmd/go/internal/load: refactor setErrorPos to PackageError.setPos
+ 2021-01-14 6aa28d3 go/build: report positions for go:embed directives
+ 2021-01-14 9734fd4 [dev.regabi] cmd/compile: use node walked flag to prevent double walk for walkSwitch
+ 2021-01-14 f979832 [dev.regabi] cmd/compile: move more PAUTOHEAP to SSA construction
+ 2021-01-14 4476300 [dev.regabi] cmd/compile: use byte for CallExpr.Use
+ 2021-01-14 5a5ab24 [dev.regabi] cmd/compile: do not rely on CallExpr.Rargs for detect already walked calls
+ 2021-01-14 983ac4b [dev.regabi] cmd/compile: fix ICE when initializing blank vars
+ 2021-01-13 7eb31d9 cmd/go: add hints to more missing sum error messages
+ 2021-01-13 d6d4673 [dev.regabi] cmd/compile: fix GOEXPERIMENT=regabi builder
+ 2021-01-13 c41b999 [dev.regabi] cmd/compile: refactor abiutils from "gc" into new "abi"
+ 2021-01-13 861707a [dev.regabi] cmd/compile: added limited //go:registerparams pragma for new ABI dev
+ 2021-01-13 c1370e9 [dev.regabi] cmd/compile: add code to support register ABI spills around morestack calls
+ 2021-01-13 2abd24f [dev.regabi] test: make run.go error messages slightly more informative
+ 2021-01-13 9a19481 [dev.regabi] cmd/compile: make ordering for InvertFlags more stable
+ 2021-01-12 ba76567 cmd/go/internal/modload: delete unused *mvsReqs.next method
+ 2021-01-12 665def2 encoding/asn1: document unmarshaling behavior for IMPLICIT string fields
+ 2021-01-11 81ea89a cmd/go: fix non-script staleness checks interacting badly with GOFLAGS
+ 2021-01-11 7593090 doc: update editors.html for Go 1.16
+ 2021-01-11 c3b4c70 cmd/internal/objfile: don't require runtime.symtab symbol for XCOFF
+ 2021-01-08 59bfc18 cmd/go: add hint to read 'go help vcs' to GOVCS errors
+ 2021-01-08 cd6f3a5 cmd/go: revise 'go help' documentation for modules
+ 2021-01-08 6192b98 cmd/go: make hints in error messages more consistent
+ 2021-01-08 25886cf cmd/go: preserve sums for indirect deps fetched by 'go mod download'
+ 2021-01-08 6250833 runtime/metrics: mark histogram metrics as cumulative
+ 2021-01-08 8f6a9ac runtime/metrics: remove unused StopTheWorld Description field
+ 2021-01-08 6598c65 cmd/compile: fix exponential-time init-cycle reporting
+ 2021-01-08 fefad1d test: fix timeout code for invoking compiler
+ 2021-01-08 6728118 cmd/go: pass signals forward during "go tool"
+ 2021-01-08 e65c543 go/build/constraint: add parser for build tag constraint expressions
+ 2021-01-08 0c5afc4 testing/fstest,os: clarify racy behavior of TestFS
+ 2021-01-08 32afcc9 runtime/metrics: change unit on *-by-size metrics to match bucket unit
+ 2021-01-08 c6513bc io/fs: minor corrections to Glob doc
+ 2021-01-08 304f769 cmd/compile: don't short-circuit copies whose source is volatile
+ 2021-01-08 ae97717 runtime,runtime/metrics: use explicit histogram boundaries
+ 2021-01-08 a9ccd2d go/build: skip string literal while findEmbed
+ 2021-01-08 d92f8ad archive/tar: fix typo in comment
+ 2021-01-08 cab1202 cmd/link: accept extra blocks in TestFallocate
+ 2021-01-08 ee4d322 io/fs: minor corrections to Glob release date
+ 2021-01-08 54bd1cc cmd: update to latest golang.org/x/tools
+ 2021-01-07 9ec21a8 Revert "reflect: support multiple keys in struct tags"
+ 2021-01-07 091414b io/fs: correct WalkDirFunc documentation
+ 2021-01-07 9b55088 doc/go1.16: add release note for disallowing non-ASCII import paths
+ 2021-01-07 fa90aac cmd/compile: fix late expand_calls leaf type for OpStructSelect/OpArraySelect
+ 2021-01-07 7cee66d cmd/go: add documentation for Embed fields in go list output
+ 2021-01-07 e60cffa html/template: attach functions to namespace
+ 2021-01-07 6da2d3b cmd/link: fix typo in asm.go
+ 2021-01-07 df81a15 runtime: check mips64 VDSO clock_gettime return code
+ 2021-01-06 4787e90 crypto/x509: rollback new CertificateRequest fields
+ 2021-01-06 c9658be cmd/go: make module suggestion more friendly
+ 2021-01-06 4c668b2 runtime/metrics: fix panic message for Float64Histogram
+ 2021-01-06 d213170 net/http/httputil: fix deadlock in DumpRequestOut
+ 2021-01-05 3e1e13c cmd/go: set cfg.BuildMod to "readonly" by default with no module root
+ 2021-01-05 0b0d004 cmd/go: pass embedcfg to gccgo if supported
+ 2021-01-05 1b85e7c cmd/go: don't scan gccgo standard library packages for imports
+ 2021-01-05 6b37b15 runtime: don't take allglock in tracebackothers
+ 2021-01-04 9eef49c math/rand: fix typo in comment
+ 2021-01-04 b01fb2a testing/fstest: fix typo in error message
+ 2021-01-01 3dd5867 doc: 2021 is the Year of the Gopher
+ 2020-12-31 95ce805 io/fs: remove darwin/arm64 special condition
+ 2020-12-30 20d0991 lib/time, time/tzdata: update tzdata to 2020f
+ 2020-12-30 ed30173 misc/cgo/testcarchive: remove special flags for Darwin/ARM
+ 2020-12-30 0ae2e03 misc/cgo/test: enable TestCrossPackageTests on darwin/arm64
+ 2020-12-29 780b4de misc/ios: fix wording for command line instructions
+ 2020-12-29 b4a71c9 doc/go1.16: reference misc/ios/README for how to build iOS programs
+ 2020-12-29 f83e0f6 misc/ios: add to README how to build ios executables
+ 2020-12-28 4fd9455 io/fs: fix typo in comment

Change-Id: If24bb93f1e1e7deb1d92ba223c85940ab93b2732
gopherbot pushed a commit that referenced this issue Jan 23, 2021
In reflect.methodWrapper, we call escape analysis without including the
full batch of dependent functions, including the closure functions.
Because of this, we haven't created locations for the params/local
variables of a closure when we are processing a function that
inlines that closure. (Whereas in the normal compilation of the
function, we do call with the full batch.) To deal with this, I am
creating locations for the params/local variables of a closure when
needed.

Without this fix, the new test closure6.go would fail.

Updates #43818

Change-Id: I5f91cfb6f35efe2937ef88cbcc468e403e0da9ad
Reviewed-on: https://go-review.googlesource.com/c/go/+/285677
Run-TryBot: Dan Scales <danscales@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
@cuonglm
Copy link
Member

@cuonglm cuonglm commented Jan 23, 2021

FWIW, the first of the CLs (the tooHairy one) made my code compile and pass tests again.

The lack of tests in the CL is a little spooky, though... 🙂

Same situation for my report. I think we should definitely add tests. I don't notice the issue until I built my program with my local go dev accidently (I usually do export GO=go1.x.x and build program with stable version).

Loading

@mdempsky
Copy link
Member

@mdempsky mdempsky commented Jan 25, 2021

Same situation for my report.

To clarify, "same situation" here means that your test program is now successfully passing as well?

I expect we will add more tests before closing this issue. The fix in CL 285676 though was just very obvious in retrospect.

If someone wants to try writing a regress test that they can confirm fails before that CL and is fixed after, that would be a welcome contribution. I'd recommend something of the form:

func ExportedFunction() func() *int {
  x := new(int)
  return func() *int {
    // [... some code that isn't exportable/inlinable ... ]
    return x
  }
}

A handful of reasonable candidate function bodies would be things like select statements, type declarations, and uses of defer and/or recover (all things we don't currently support inlining). Even better would be to have a separate package that calls foo.ExportedFunction()() to exercise potentially-inlinable calls to the function literals.

Also, FYI, the return x is valuable to make sure the function literal is actually a closure. Currently, we optimize function literals that don't use any free variables during SSA construction. I've been thinking about moving this optimization earlier in the frontend, which could then allow inlining functions even if they contain non-inlinable function literals. (So maybe it's actually worthwhile to have versions of the functions both with and without the return x.)

Loading

@cuonglm
Copy link
Member

@cuonglm cuonglm commented Jan 25, 2021

To clarify, "same situation" here means that your test program is now successfully passing as well?

Yes, that's it.

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 26, 2021

Change https://golang.org/cl/286656 mentions this issue: [dev.regabi] repro of issue43818

Loading

@gopherbot
Copy link

@gopherbot gopherbot commented Jan 31, 2021

Change https://golang.org/cl/288392 mentions this issue: [dev.regabi] test: add a test for inlining closures

Loading

gopherbot pushed a commit that referenced this issue Feb 1, 2021
Add a test case for issue 43818. We don't want to mark as inlinable a
function with a closure that has an operation (such as OSELRECV2) that
we don't currently support for exporting. This test case fails to
compile without the fix for #43818.

Updates #43818

Change-Id: Ief322a14aefaefc6913c40a6b8505214bd622fda
Reviewed-on: https://go-review.googlesource.com/c/go/+/288392
Run-TryBot: Dan Scales <danscales@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Dan Scales <danscales@google.com>
@danscales
Copy link

@danscales danscales commented Feb 1, 2021

Fixed the bug and just added a test case.

Loading

@danscales danscales closed this Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
6 participants