]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix deriving from x+d >= w on overflow in prove pass
authorCherry Zhang <cherryyz@google.com>
Wed, 2 Jan 2019 17:27:55 +0000 (12:27 -0500)
committerCherry Zhang <cherryyz@google.com>
Wed, 2 Jan 2019 19:28:06 +0000 (19:28 +0000)
commit2e217fa726a624093eea5b099d1531c79e27a423
tree131e5ce6fed36142a3eb9240ce1c89d1872d934c
parent1f035d036c2a49c1b858af3260552ccaac80858d
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.

Fixes #29502.

Change-Id: Ia9f7d814264b1a3ddf78f52e2ce23377450e6e8a
Reviewed-on: https://go-review.googlesource.com/c/156019
Reviewed-by: David Chase <drchase@google.com>
src/cmd/compile/internal/ssa/prove.go
test/prove.go