Source file test/fixedbugs/issue32560.go
1 // run 2 3 // Copyright 2019 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 // Values smaller than 64-bits were mistakenly always proven to be 8 // non-negative. 9 // 10 // The tests here are marked go:noinline to ensure they're 11 // independently optimized by SSA. 12 13 package main 14 15 var x int32 = -1 16 17 //go:noinline 18 func a() { 19 if x != -1 { 20 panic(1) 21 } 22 if x > 0 || x != -1 { 23 panic(2) 24 } 25 } 26 27 //go:noinline 28 func b() { 29 if x != -1 { 30 panic(3) 31 } 32 if x > 0 { 33 panic(4) 34 } 35 } 36 37 //go:noinline 38 func c() { 39 if x > 0 || x != -1 { 40 panic(5) 41 } 42 if x > 0 || x != -1 { 43 panic(6) 44 } 45 } 46 47 func main() { 48 a() 49 b() 50 c() 51 } 52