aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/gc/walk.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/compile/internal/gc/walk.go')
-rw-r--r--src/cmd/compile/internal/gc/walk.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go
index ca3025bbaa..79134067c6 100644
--- a/src/cmd/compile/internal/gc/walk.go
+++ b/src/cmd/compile/internal/gc/walk.go
@@ -3561,6 +3561,12 @@ func walkinrange(n *Node, init *Nodes) *Node {
return n
}
+ // Ensure that Int64() does not overflow on a and c (it'll happen
+ // for any const above 2**63; see issue #27143).
+ if !a.CanInt64() || !c.CanInt64() {
+ return n
+ }
+
if opl == OLT {
// We have a < b && ...
// We need a ≤ b && ... to safely use unsigned comparison tricks.