Source file test/fixedbugs/issue12108.go

     1  // run
     2  
     3  // Copyright 2015 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  // A generated method with a return value large enough to be
     8  // initialized by duffzero is not a leaf method, which violated
     9  // assumptions made by cmd/internal/obj/ppc64.
    10  
    11  package main
    12  
    13  const N = 9 // values > 8 cause (Super).Method to use duffzero
    14  
    15  type Base struct {
    16  }
    17  
    18  func (b *Base) Method() (x [N]uintptr) {
    19  	return
    20  }
    21  
    22  type Super struct {
    23  	Base
    24  }
    25  
    26  type T interface {
    27  	Method() [N]uintptr
    28  }
    29  
    30  func f(q T) {
    31  	q.Method()
    32  }
    33  
    34  func main() {
    35  	var s Super
    36  	f(&s)
    37  }
    38  

View as plain text