mirror of
https://github.com/golang/go
synced 2024-11-23 07:00:05 -07:00
5fac45a320
CL 212777 added a check to isNonNegative to return true for unsigned values. However, the SSA backend isn't type safe enough for that to be sound. The other checks in isNonNegative look only at the pattern of bits. Remove the type-based check. Updates #37753 Change-Id: I059d0e86353453133f2a160dce53af299f42e533 Reviewed-on: https://go-review.googlesource.com/c/go/+/222620 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
19 lines
301 B
Go
19 lines
301 B
Go
// run
|
|
|
|
// Copyright 2020 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
//go:noinline
|
|
func f(a, b uint) int {
|
|
return int(a-b) / 8
|
|
}
|
|
|
|
func main() {
|
|
if x := f(1, 2); x != 0 {
|
|
panic(x)
|
|
}
|
|
}
|