]> Cypherpunks.ru repositories - gostls13.git/blob - test/fixedbugs/issue52788.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / test / fixedbugs / issue52788.go
1 // run
2
3 // Copyright 2022 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 // Issue 52788: miscompilation for boolean comparison on ARM64.
8
9 package main
10
11 import (
12         "fmt"
13         "reflect"
14 )
15
16 func f(next func() bool) {
17         for b := next(); b; b = next() {
18                 fmt.Printf("next() returned %v\n", b)
19         }
20 }
21
22 func main() {
23         next := reflect.MakeFunc(reflect.TypeOf((func() bool)(nil)), func(_ []reflect.Value) []reflect.Value {
24                 return []reflect.Value{reflect.ValueOf(false)}
25         })
26         reflect.ValueOf(f).Call([]reflect.Value{next})
27 }