1 // Copyright 2015 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
8 #cgo LDFLAGS: -fsanitize=memory
9 #cgo CPPFLAGS: -fsanitize=memory
15 void f(int32_t *p, int n) {
16 int32_t * volatile q = (int32_t *)malloc(sizeof(int32_t) * n);
17 memcpy(p, q, n * sizeof(*p));
21 void g(int32_t *p, int n) {
34 a := make([]int32, 10)
35 C.f((*C.int32_t)(unsafe.Pointer(&a[0])), C.int(len(a)))
37 C.g((*C.int32_t)(unsafe.Pointer(&a[0])), C.int(len(a)))