Debian Codegraph @

test/fixedbugs/issue39651.go

raw
1 // run
2
3 // Copyright 2020 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 // Test that float -> integer conversion doesn't clobber
8 // flags.
9
10 package main
11
12 //go:noinline
13 func f(x, y float64, a, b *bool, r *int64) {
14 *a = x < y // set flags
15 *r = int64(x) // clobber flags
16 *b = x == y // use flags
17 }
18
19 func main() {
20 var a, b bool
21 var r int64
22 f(1, 1, &a, &b, &r)
23 if a || !b {
24 panic("comparison incorrect")
25 }
26 }