Fixes #60439
Change-Id: I09fcd2d3deb7f80ed012a769fdb6f53b09c0290b
Reviewed-on: https://go-review.googlesource.com/c/go/+/502895
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
}
}
+ // For functions originally came from package runtime,
+ // mark as norace to prevent instrumenting, see issue #60439.
+ for _, n := range target.Decls {
+ if fn, ok := n.(*ir.Func); ok {
+ if !base.Flag.CompilingRuntime && types.IsRuntimePkg(fn.Sym().Pkg) {
+ fn.Pragma |= ir.Norace
+ }
+ }
+ }
+
base.ExitIfErrors() // just in case
}
func GetPinnerLeakPanic() func() {
return pinnerLeakPanic
}
+
+var testUintptr uintptr
+
+func MyGenericFunc[T any]() {
+ systemstack(func() {
+ testUintptr = 4
+ })
+}
t.Fatalf("expected %q, but got %q", want, got)
}
}
+
+func TestMyGenericFunc(t *testing.T) {
+ runtime.MyGenericFunc[int]()
+}