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 9package main 10 11import ( 12 "fmt" 13 "reflect" 14) 15 16func f(next func() bool) { 17 for b := next(); b; b = next() { 18 fmt.Printf("next() returned %v\n", b) 19 } 20} 21 22func 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} 28