0
1
mirror of https://github.com/golang/go synced 2024-12-11 15:21:00 +00:00
go/test/fixedbugs/issue16241_64.go
Jorropo d241ea8d5c sync/atomic: add missing leak tests for And & Or
Theses tests were forgot because when CL 462298 was originally written
And & Or atomics were not available in go.
Git were smart enough to rebase over And's & Or's addition.
After most reviews and before merging it were pointed I should
make theses new intrinsics noescape.
When doing this last minute addition I forgot to add tests.

Change-Id: I457f98315c0aee91d5743058ab76f256856cb782
Reviewed-on: https://go-review.googlesource.com/c/go/+/633416
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2024-12-04 17:30:39 +00:00

61 lines
1.5 KiB
Go

//go:build !(386 || arm || mips || mipsle)
// errorcheck -0 -m -l
// Copyright 2023 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 foo
import "sync/atomic"
func AddInt64(x *int64) { // ERROR "x does not escape$"
atomic.AddInt64(x, 42)
}
func AddUint64(x *uint64) { // ERROR "x does not escape$"
atomic.AddUint64(x, 42)
}
func AndInt64(x *int64) { // ERROR "x does not escape$"
atomic.AndInt64(x, 42)
}
func AndUint64(x *uint64) { // ERROR "x does not escape$"
atomic.AndUint64(x, 42)
}
func CompareAndSwapInt64(x *int64) { // ERROR "x does not escape$"
atomic.CompareAndSwapInt64(x, 42, 42)
}
func CompareAndSwapUint64(x *uint64) { // ERROR "x does not escape$"
atomic.CompareAndSwapUint64(x, 42, 42)
}
func LoadInt64(x *int64) { // ERROR "x does not escape$"
atomic.LoadInt64(x)
}
func LoadUint64(x *uint64) { // ERROR "x does not escape$"
atomic.LoadUint64(x)
}
func OrInt64(x *int64) { // ERROR "x does not escape$"
atomic.OrInt64(x, 42)
}
func OrUint64(x *uint64) { // ERROR "x does not escape$"
atomic.OrUint64(x, 42)
}
func StoreInt64(x *int64) { // ERROR "x does not escape$"
atomic.StoreInt64(x, 42)
}
func StoreUint64(x *uint64) { // ERROR "x does not escape$"
atomic.StoreUint64(x, 42)
}
func SwapInt64(x *int64) { // ERROR "x does not escape$"
atomic.SwapInt64(x, 42)
}
func SwapUint64(x *uint64) { // ERROR "x does not escape$"
atomic.SwapUint64(x, 42)
}