Gopher Robot submitted the change![Open in Gerrit]()
Change information
Commit message:
cmd/compile: avoid folding 64-bit integers into 32-bit constants
Folding a 64-bit integer into a 32-bit constant may result in a negative
integer if the value exceeds math.MaxInt32 (the maximum value of a 32-
bit signed integer). This negative value will be sign-extended to 64
bits at runtime, leading to unexpected results when used in bitwise
AND/OR operations.
Fixes #77613
Change-Id: Idb081a3c20c28bddddcc8eff1225d62123b37a2d
Files:
- M src/cmd/compile/internal/ssa/_gen/AMD64.rules
- M src/cmd/compile/internal/ssa/rewriteAMD64.go
- A test/fixedbugs/issue77613.go
Change size: M
Delta: 3 files changed, 48 insertions(+), 4 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Code-Review: +2 by Keith Randall, +1 by Keith Randall, +1 by Dmitri Shuralyov
TryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Idb081a3c20c28bddddcc8eff1225d62123b37a2d
Gerrit-Change-Number: 745581
Gerrit-PatchSet: 3