]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: ensure stenciled function bodies are nonempty
authorKeith Randall <khr@golang.org>
Thu, 11 Nov 2021 16:45:02 +0000 (08:45 -0800)
committerKeith Randall <khr@golang.org>
Thu, 11 Nov 2021 20:34:56 +0000 (20:34 +0000)
commit10d3b1355184320f6d9623cb35e848e5af7c29ed
tree5364b8935d692b6b1c90ab2455d3da951681cf6e
parentc622d1d3f68369ec5f8ce9694fa27e7acb025004
cmd/compile: ensure stenciled function bodies are nonempty

Our compiler gets confused between functions that were declared
with no body, and those which have a body but it is empty.

Ensure that when stenciling, we generate a nonempty body.

The particular test that causes this problem is in
cmd/compile/internal/gc/main.go:enqueueFunc. It thinks that if
a function has no body, then we need to generate ABI wrappers for
it, but not compile it.

Fixes #49524

Change-Id: Id962666a2098f60a2421484b6a776eafdc4f4a63
Reviewed-on: https://go-review.googlesource.com/c/go/+/363395
Trust: Keith Randall <khr@golang.org>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
src/cmd/compile/internal/noder/stencil.go
test/typeparam/issue49524.dir/a.go [new file with mode: 0644]
test/typeparam/issue49524.dir/main.go [new file with mode: 0644]
test/typeparam/issue49524.go [new file with mode: 0644]