diff options
Diffstat (limited to 'test/nilptr/arraytoslice.go')
-rw-r--r-- | test/nilptr/arraytoslice.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/test/nilptr/arraytoslice.go b/test/nilptr/arraytoslice.go index 65b2f8a76..03879fb42 100644 --- a/test/nilptr/arraytoslice.go +++ b/test/nilptr/arraytoslice.go @@ -1,4 +1,3 @@ -// [ $GOOS != nacl ] || exit 0 # do not bother on NaCl // $G $D/$F.go && $L $F.$A && // ((! sh -c ./$A.out) >/dev/null 2>&1 || echo BUG: should fail) @@ -11,10 +10,10 @@ package main import "unsafe" func f([]byte) { - panic("unreachable"); + panic("unreachable") } -var dummy [512<<20]byte; // give us a big address space +var dummy [512<<20]byte // give us a big address space func main() { // the test only tests what we intend to test // if dummy starts in the first 256 MB of memory. @@ -22,7 +21,7 @@ func main() { // at the address that might be accidentally // dereferenced below. if uintptr(unsafe.Pointer(&dummy)) > 256<<20 { - panic("dummy too far out"); + panic("dummy too far out") } // The problem here is that indexing into p[] with a large @@ -32,6 +31,6 @@ func main() { // To avoid needing a check on every slice beyond the // usual len and cap, we require the *array -> slice // conversion to do the check. - var p *[1<<30]byte = nil; - f(p); // should crash + var p *[1<<30]byte = nil + f(p[0:]) // should crash } |