Source file test/abi/zombie_struct_select.go

     1  // run
     2  
     3  // Copyright 2021 The Go Authors. All rights reserved.
     4  // Use of this source code is governed by a BSD-style
     5  // license that can be found in the LICENSE file.
     6  
     7  package main
     8  
     9  type patchlist struct {
    10  	head, tail uint32
    11  }
    12  
    13  type frag struct {
    14  	i   uint32
    15  	out patchlist
    16  }
    17  
    18  //go:noinline
    19  //go:registerparams
    20  func patch(l patchlist, i uint32) {
    21  }
    22  
    23  //go:noinline
    24  //go:registerparams
    25  func badbad(f1, f2 frag) frag {
    26  	// concat of failure is failure
    27  	if f1.i == 0 || f2.i == 0 { // internal compiler error: 'badbad': incompatible OpArgIntReg [4]: v42 and v26
    28  		return frag{}
    29  	}
    30  	patch(f1.out, f2.i)
    31  	return frag{f1.i, f2.out}
    32  }
    33  
    34  func main() {
    35  	badbad(frag{i: 2}, frag{i: 3})
    36  }
    37  

View as plain text