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

gopherbot opened this issue Jun 12, 2019 · 3 comments


Copy link

@gopherbot gopherbot commented Jun 12, 2019

@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.


This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jun 12, 2019

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


This comment has been minimized.

Copy link

@katiehockman katiehockman commented Jun 17, 2019

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

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
Run-TryBot: Matthew Dempsky <>
Reviewed-by: Josh Bleecher Snyder <>
Reviewed-by: David Chase <>
Reviewed-by: Keith Randall <>
TryBot-Result: Gobot Gobot <>
(cherry picked from commit f44404e)
Reviewed-by: Russ Cox <>

This comment has been minimized.

Copy link

@rsc rsc commented Jul 1, 2019

Fixed by CL 181979 / f056928.

@rsc rsc closed this Jul 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.