modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue15013.go (about)

     1  // compile
     2  
     3  // Copyright 2016 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  // CL 21202 introduced a compiler crash in the handling of a varargs
     8  // function in the same recursive group as a function that calls it.
     9  // Nothing in the standard library caught the problem, so adding a test.
    10  
    11  package p
    12  
    13  func F1(p *int, a ...*int) (int, *int) {
    14  	if p == nil {
    15  		return F2(), a[0]
    16  	}
    17  	return 0, a[0]
    18  }
    19  
    20  func F2() int {
    21  	var i0, i1 int
    22  	a, _ := F1(&i0, &i1)
    23  	return a
    24  }