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 ops on ARM64. 8 9package main 10 11import ( 12 "fmt" 13 "reflect" 14 "os" 15) 16 17func f(next func() bool) { 18 for b := next(); b; b = next() { 19 fmt.Printf("%v\n", b) 20 os.Exit(0) 21 } 22} 23 24func main() { 25 next := reflect.MakeFunc(reflect.TypeOf((func() bool)(nil)), func(_ []reflect.Value) []reflect.Value { 26 return []reflect.Value{reflect.ValueOf(true)} 27 }) 28 reflect.ValueOf(f).Call([]reflect.Value{next}) 29} 30