]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.12] cmd/compile: fix range analysis of small signed integers
authorMatthew Dempsky <mdempsky@google.com>
Wed, 12 Jun 2019 02:52:58 +0000 (19:52 -0700)
committerRuss Cox <rsc@golang.org>
Mon, 1 Jul 2019 17:23:23 +0000 (17:23 +0000)
commit39b533ed6634079a5c4f6a3488f4b01cdab2d833
tree7c59b4203e564c88db9a866c11635aa73343aac7
parent77c14d2973aa9365bf07ebe9b2c17585f8cece0c
[release-branch.go1.12] cmd/compile: fix range analysis of small signed integers

For int8, int16, and int32, comparing their unsigned value to MaxInt64
to determine non-negativity doesn't make sense, because they have
negative values whose unsigned representation is smaller than that.
Fix is simply to compare with the appropriate upper bound based on the
value type's size.

Fixes #32583.

Change-Id: Ie7afad7a56af92bd890ba5ff33c86d1df06cfd9a
Reviewed-on: https://go-review.googlesource.com/c/go/+/181797
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
(cherry picked from commit f44404ebbfeff57f3e45ebf4b314a320bb89841f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/181978
Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
src/cmd/compile/internal/ssa/prove.go
test/fixedbugs/issue32560.go [new file with mode: 0644]