]> Cypherpunks repositories - gostls13.git/commit
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)
committerMatthew Dempsky <mdempsky@google.com>
Wed, 12 Jun 2019 18:03:46 +0000 (18:03 +0000)
commitf44404ebbfeff57f3e45ebf4b314a320bb89841f
tree4e76a2aa951eb65617c6d50092ae53c1b329a23d
parent87367cf86a0a8390418a8e2431a11d5dcdddff72
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 #32560.

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>
src/cmd/compile/internal/ssa/prove.go
test/fixedbugs/issue32560.go [new file with mode: 0644]