1
0
mirror of https://github.com/golang/go synced 2024-11-17 22:24:47 -07:00
go/test/abi/zombie_struct_select.go
David Chase 254948a50e 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>
2021-04-02 17:58:59 +00:00

37 lines
676 B
Go

// 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})
}