mirror of
https://github.com/golang/go.git
synced 2025-05-05 15:43:04 +00:00
We only want to call into the race detector for Go global variables. By rounding up the region bounds, we can include some C globals. Even worse, we can include only *part* of a C global, leading to race{read,write}range calls which straddle the end of shadow memory. That causes the race detector to barf. Fix some off-by-one errors in the assembly comparisons. We want to skip calling the race detector when addr == racedataend. Fixes #73483 Change-Id: I436b0f588d6165b61f30cb7653016ba9b7cbf585 Reviewed-on: https://go-review.googlesource.com/c/go/+/667655 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitry Vyukov <dvyukov@google.com>
21 lines
301 B
Go
21 lines
301 B
Go
// 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[:])
|
|
}
|