]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.11] cmd/compile: fix deriving from x+d >= w on overflow in prove...
authorCherry Zhang <cherryyz@google.com>
Wed, 2 Jan 2019 17:27:55 +0000 (12:27 -0500)
committerIan Lance Taylor <iant@golang.org>
Mon, 25 Feb 2019 21:58:21 +0000 (21:58 +0000)
commitc8c897a67066ef9e6011933ea5fead3bfa6b2333
treefa142f5c919d7bc1b62ff466b6bfc81046fc4080
parent3705d34af14eb7aea26a2e0ce97bf6e3b09b0c28
[release-branch.go1.11] cmd/compile: fix deriving from x+d >= w on overflow in prove pass

In the case of x+d >= w, where d and w are constants, we are
deriving x is within the bound of min=w-d and max=maxInt-d. When
there is an overflow (min >= max), we know only one of x >= min
or x <= max is true, and we derive this by excluding the other.
When excluding x >= min, we did not consider the equal case, so
we could incorrectly derive x <= max when x == min.

Updates #29502.
Fixes #29503.

Change-Id: Ia9f7d814264b1a3ddf78f52e2ce23377450e6e8a
Reviewed-on: https://go-review.googlesource.com/c/156019
Reviewed-by: David Chase <drchase@google.com>
(cherry picked from commit 2e217fa726a624093eea5b099d1531c79e27a423)
Reviewed-on: https://go-review.googlesource.com/c/163724
Run-TryBot: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/ssa/prove.go
test/prove.go