1 // [ $GOOS != nacl ] || exit 0 # do not bother on NaCl
2 // $G $D/$F.go && $L $F.$A &&
3 // ((! sh -c ./$A.out) >/dev/null 2>&1 || echo BUG: should fail)
5 // Copyright 2009 The Go Authors. All rights reserved.
6 // Use of this source code is governed by a BSD-style
7 // license that can be found in the LICENSE file.
16 var p
*[1<<30]byte = nil
19 // The problem here is not the use of unsafe:
20 // it is that indexing into p[] with a large
21 // enough index jumps out of the unmapped section
22 // at the beginning of memory and into valid memory.
23 // Pointer offsets and array indices, if they are
24 // very large, need to dereference the base pointer
26 println(p
[uintptr(unsafe
.Pointer(&x
))]) // should crash