diff options
author | David Chase <drchase@google.com> | 2021-04-02 12:33:23 -0400 |
---|---|---|
committer | David Chase <drchase@google.com> | 2021-04-02 17:58:59 +0000 |
commit | 254948a50e12aac1059816a1575ccef1b3892723 (patch) | |
tree | f37c3cf22892f2fa72f0c4a1f1552286bba505ce /test/abi | |
parent | 28c5fed5576483cc696db233d7f6fffecd2833a2 (diff) | |
download | go-254948a50e12aac1059816a1575ccef1b3892723.tar.gz go-254948a50e12aac1059816a1575ccef1b3892723.zip |
cmd/compile: mark unused values as invalid to prevent problems in expandCalls
Leftover values that have been replaced can cause problems in later
passes (within expandCalls). For example, a struct select that
itself yields a struct will have a problematic rewrite, if the chance
is presented.
Updates #40724.
Change-Id: I1b445c47c301c3705f7fc0a9d39f1f5c84f4e190
Reviewed-on: https://go-review.googlesource.com/c/go/+/306869
Trust: David Chase <drchase@google.com>
Run-TryBot: David Chase <drchase@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
Diffstat (limited to 'test/abi')
-rw-r--r-- | test/abi/zombie_struct_select.go | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/abi/zombie_struct_select.go b/test/abi/zombie_struct_select.go new file mode 100644 index 0000000000..d0cab98182 --- /dev/null +++ b/test/abi/zombie_struct_select.go @@ -0,0 +1,36 @@ +// run + +// Copyright 2021 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +type patchlist struct { + head, tail uint32 +} + +type frag struct { + i uint32 + out patchlist +} + +//go:noinline +//go:registerparams +func patch(l patchlist, i uint32) { +} + +//go:noinline +//go:registerparams +func badbad(f1, f2 frag) frag { + // concat of failure is failure + if f1.i == 0 || f2.i == 0 { // internal compiler error: 'badbad': incompatible OpArgIntReg [4]: v42 and v26 + return frag{} + } + patch(f1.out, f2.i) + return frag{f1.i, f2.out} +} + +func main() { + badbad(frag{i: 2}, frag{i: 3}) +} |