mirror of
https://github.com/golang/go.git
synced 2026-04-02 17:30:01 +09:00
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 Reviewed-on: https://go-review.googlesource.com/c/go/+/745581 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
29 lines
465 B
Go
29 lines
465 B
Go
// run
|
|
|
|
// Copyright 2026 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package main
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
func main() {
|
|
str1 := "你好世界"
|
|
if !strings.HasSuffix(str1, "世界") {
|
|
panic(1)
|
|
}
|
|
|
|
str2 := "こんにちは"
|
|
if !strings.HasSuffix(str2, "ちは") {
|
|
panic(2)
|
|
}
|
|
|
|
str3 := "спасибо"
|
|
if !strings.HasSuffix(str3, "ибо") {
|
|
panic(3)
|
|
}
|
|
}
|