mirror of
https://github.com/golang/go
synced 2024-11-18 09:34:53 -07:00
880a689124
The runtime is not instrumented, but the calls to msanread in the runtime can sometimes refer to the system stack. An example is the call to copy in stkbucket in mprof.go. Depending on what C code has done, the system stack may appear uninitialized to msan. Change-Id: Ic21705b9ac504ae5cf7601a59189302f072e7db1 Reviewed-on: https://go-review.googlesource.com/16660 Reviewed-by: David Crawshaw <crawshaw@golang.org>
36 lines
541 B
Go
36 lines
541 B
Go
// Copyright 2015 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
|
|
|
|
/*
|
|
#include <stdint.h>
|
|
|
|
void f(int32_t *p, int n) {
|
|
int i;
|
|
|
|
for (i = 0; i < n; i++) {
|
|
p[i] = (int32_t)i;
|
|
}
|
|
}
|
|
*/
|
|
import "C"
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"unsafe"
|
|
)
|
|
|
|
func main() {
|
|
a := make([]int32, 10)
|
|
C.f((*C.int32_t)(unsafe.Pointer(&a[0])), C.int(len(a)))
|
|
for i, v := range a {
|
|
if i != int(v) {
|
|
fmt.Println("bad %d: %v\n", i, a)
|
|
os.Exit(1)
|
|
}
|
|
}
|
|
}
|