| 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 |
package main |
| 8 |
|
| 9 |
import "math" |
| 10 |
|
| 11 |
func main() { |
| 12 |
f() |
| 13 |
g() |
| 14 |
h() |
| 15 |
j(math.MinInt64) |
| 16 |
} |
| 17 |
func f() { |
| 18 |
for i := int64(math.MaxInt64); i <= math.MaxInt64; i++ { |
| 19 |
if i < 0 { |
| 20 |
println("done") |
| 21 |
return |
| 22 |
} |
| 23 |
println(i, i < 0) |
| 24 |
} |
| 25 |
} |
| 26 |
func g() { |
| 27 |
for i := int64(math.MaxInt64) - 1; i <= math.MaxInt64; i++ { |
| 28 |
if i < 0 { |
| 29 |
println("done") |
| 30 |
return |
| 31 |
} |
| 32 |
println(i, i < 0) |
| 33 |
} |
| 34 |
} |
| 35 |
func h() { |
| 36 |
for i := int64(math.MaxInt64) - 2; i <= math.MaxInt64; i += 2 { |
| 37 |
if i < 0 { |
| 38 |
println("done") |
| 39 |
return |
| 40 |
} |
| 41 |
println(i, i < 0) |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
//go:noinline |
| 46 |
func j(i int64) { |
| 47 |
for j := int64(math.MaxInt64); j <= i-1; j++ { |
| 48 |
if j < 0 { |
| 49 |
break |
| 50 |
} |
| 51 |
println(j) |
| 52 |
} |
| 53 |
} |