Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: switch statement on a custom int32 type with negative values behaves differently in two consecutive calls [1.11 backport] #32582

Closed
gopherbot opened this issue Jun 12, 2019 · 3 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@gopherbot
Copy link

@josharian requested issue #32560 to be considered for backport to the next 1.11 minor release.

@gopherbot please open backport issues. This is an important compiler correctness bug with a safe, localized, minimal fix.

@gopherbot
Copy link
Author

Change https://golang.org/cl/181979 mentions this issue: [release-branch.go1.11] cmd/compile: fix range analysis of small signed integers

@katiehockman
Copy link
Contributor

Approving this cherry-pick since it is a localized, small risk change with no workaround.

@katiehockman katiehockman added CherryPickApproved Used during the release process for point releases and removed CherryPickCandidate Used during the release process for point releases labels Jun 17, 2019
gopherbot pushed a commit that referenced this issue Jul 1, 2019
…ed 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 #32582.

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 f44404e)
Reviewed-on: https://go-review.googlesource.com/c/go/+/181979
Reviewed-by: Russ Cox <rsc@golang.org>
@rsc
Copy link
Contributor

rsc commented Jul 1, 2019

Fixed by CL 181979 / f056928.

@rsc rsc closed this as completed Jul 1, 2019
@golang golang locked and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

3 participants