]> Cypherpunks repositories - gostls13.git/commitdiff
sync/atomic: add missing leak tests for And & Or
authorJorropo <jorropo.pgm@gmail.com>
Wed, 4 Dec 2024 03:50:29 +0000 (04:50 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Wed, 4 Dec 2024 17:30:39 +0000 (17:30 +0000)
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>

test/fixedbugs/issue16241.go
test/fixedbugs/issue16241_64.go

index 33f1aa3dee5723e52e91172303962324eaf05c9f..a88dc9a40aa842aff23d1ba664b6fde3763f4f17 100644 (file)
@@ -18,6 +18,16 @@ func AddUintptr(x *uintptr) { // ERROR "x does not escape$"
        atomic.AddUintptr(x, 42)
 }
 
+func AndInt32(x *int32) { // ERROR "x does not escape$"
+       atomic.AndInt32(x, 42)
+}
+func AndUint32(x *uint32) { // ERROR "x does not escape$"
+       atomic.AndUint32(x, 42)
+}
+func AndUintptr(x *uintptr) { // ERROR "x does not escape$"
+       atomic.AndUintptr(x, 42)
+}
+
 func CompareAndSwapInt32(x *int32) { // ERROR "x does not escape$"
        atomic.CompareAndSwapInt32(x, 42, 42)
 }
@@ -38,6 +48,16 @@ func LoadUintptr(x *uintptr) { // ERROR "x does not escape$"
        atomic.LoadUintptr(x)
 }
 
+func OrInt32(x *int32) { // ERROR "x does not escape$"
+       atomic.OrInt32(x, 42)
+}
+func OrUint32(x *uint32) { // ERROR "x does not escape$"
+       atomic.OrUint32(x, 42)
+}
+func OrUintptr(x *uintptr) { // ERROR "x does not escape$"
+       atomic.OrUintptr(x, 42)
+}
+
 func StoreInt32(x *int32) { // ERROR "x does not escape$"
        atomic.StoreInt32(x, 42)
 }
index 82626cb796b77c572f9ad1f8307d16050d0d1a0c..468444bdd778a32dd040b1ee785456b1e67884d9 100644 (file)
@@ -17,6 +17,13 @@ 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)
 }
@@ -31,6 +38,13 @@ 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)
 }