racecall(&__tsan_init, uintptr(unsafe.Pointer(&gctx)), uintptr(unsafe.Pointer(&pctx)), abi.FuncPCABI0(racecallbackthunk), 0)
- // Round data segment to page boundaries, because it's used in mmap().
start := ^uintptr(0)
end := uintptr(0)
if start > firstmoduledata.noptrdata {
if end < firstmoduledata.ebss {
end = firstmoduledata.ebss
}
- size := alignUp(end-start, _PageSize)
- racecall(&__tsan_map_shadow, start, size, 0, 0)
+ // Use exact bounds for boundary check in racecalladdr. See issue 73483.
racedatastart = start
- racedataend = start + size
+ racedataend = end
+ // Round data segment to page boundaries for race detector (TODO: still needed?)
+ start = alignDown(start, _PageSize)
+ end = alignUp(end, _PageSize)
+ racecall(&__tsan_map_shadow, start, end-start, 0, 0)
return
}
BLT ret
MOVD runtime·racedataend(SB), R9
CMP R4, R9
- BGT ret
+ BGE ret
call:
// Careful!! racecall will save LR on its
// stack, which is OK as long as racecalladdr
--- /dev/null
+// run -race
+
+//go:build race && cgo
+
+// Copyright 2025 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
+
+/*
+ int v[8192];
+*/
+import "C"
+
+var x [8192]C.int
+
+func main() {
+ copy(C.v[:], x[:])
+}