aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/testdata
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2016-02-18 11:04:05 -0800
committerIan Lance Taylor <iant@golang.org>2016-02-19 16:07:27 +0000
commitc8e7b34b599c9e3c6747b3e8182e65a2145fd06f (patch)
treee93d6ad2055cdc20265d3037251f9b78199ac408 /src/runtime/testdata
parent277024bd6f3ecc9f34729cbeb95e226f70004733 (diff)
downloadgo-c8e7b34b599c9e3c6747b3e8182e65a2145fd06f.tar.xz
runtime: skip cgo check for non-pointer slice elements
Fixes #14387. Change-Id: Icc98be80f549c5e1f55c5e693bfea97b456a6c41 Reviewed-on: https://go-review.googlesource.com/19621 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'src/runtime/testdata')
-rw-r--r--src/runtime/testdata/testprogcgo/cgo.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/runtime/testdata/testprogcgo/cgo.go b/src/runtime/testdata/testprogcgo/cgo.go
index cf1af8268c..5d2550dbb0 100644
--- a/src/runtime/testdata/testprogcgo/cgo.go
+++ b/src/runtime/testdata/testprogcgo/cgo.go
@@ -6,17 +6,20 @@ package main
/*
void foo1(void) {}
+void foo2(void* p) {}
*/
import "C"
import (
"fmt"
"runtime"
"time"
+ "unsafe"
)
func init() {
register("CgoSignalDeadlock", CgoSignalDeadlock)
register("CgoTraceback", CgoTraceback)
+ register("CgoCheckBytes", CgoCheckBytes)
}
func CgoSignalDeadlock() {
@@ -78,3 +81,10 @@ func CgoTraceback() {
runtime.Stack(buf, true)
fmt.Printf("OK\n")
}
+
+func CgoCheckBytes() {
+ b := make([]byte, 1e6)
+ for i := 0; i < 1e3; i++ {
+ C.foo2(unsafe.Pointer(&b[0]))
+ }
+}