modernc.org/gc@v1.0.1-0.20240304020402-f0dba7c97c2b/testdata/errchk/test/fixedbugs/issue18808.go (about) 1 // run 2 3 // Copyright 2017 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 const lim = 0x80000000 10 11 //go:noinline 12 func eq(x uint32) { 13 if x == lim { 14 return 15 } 16 panic("x == lim returned false") 17 } 18 19 //go:noinline 20 func neq(x uint32) { 21 if x != lim { 22 panic("x != lim returned true") 23 } 24 } 25 26 //go:noinline 27 func gt(x uint32) { 28 if x > lim { 29 return 30 } 31 panic("x > lim returned false") 32 } 33 34 //go:noinline 35 func gte(x uint32) { 36 if x >= lim { 37 return 38 } 39 panic("x >= lim returned false") 40 } 41 42 //go:noinline 43 func lt(x uint32) { 44 if x < lim { 45 panic("x < lim returned true") 46 } 47 } 48 49 //go:noinline 50 func lte(x uint32) { 51 if x <= lim { 52 panic("x <= lim returned true") 53 } 54 } 55 56 func main() { 57 eq(lim) 58 neq(lim) 59 gt(lim+1) 60 gte(lim+1) 61 lt(lim+1) 62 lte(lim+1) 63 }