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

     1  // run
     2  
     3  // Copyright 2018 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  // +build gccgo
     8  
     9  // Issue 23545: gccgo didn't lower array comparison to
    10  // proper equality function in some case.
    11  // TODO: build only on gccgo for now, as it hits issue
    12  // #23546.
    13  
    14  package main
    15  
    16  func main() {
    17  	if a := Get(); a != dummyID(1234) {
    18  		panic("FAIL")
    19  	}
    20  }
    21  
    22  func dummyID(x int) [Size]interface{} {
    23  	var out [Size]interface{}
    24  	out[0] = x
    25  	return out
    26  }
    27  
    28  const Size = 32
    29  
    30  type OutputID [Size]interface{}
    31  
    32  //go:noinline
    33  func Get() OutputID {
    34  	return dummyID(1234)
    35  }