diff options
author | Russ Cox <rsc@golang.org> | 2014-11-14 12:09:42 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2014-11-14 12:09:42 -0500 |
commit | 66fbfa707147ff58e13beed2d4a957a06bede869 (patch) | |
tree | 7840efde671c3cf7bfc68400770eca53aabcb6f8 /test | |
parent | f4110c2e9cc8f316e14f3a4a35789bc821b326bf (diff) | |
parent | 9cabb766eb4acbe2c11ad0084659710919f40c0d (diff) | |
download | go-66fbfa707147ff58e13beed2d4a957a06bede869.tar.gz |
[dev.garbage] all: merge dev.power64 (7667e41f3ced) into dev.garbage
Now the only difference between dev.cc and dev.garbage
is the runtime conversion on the one side and the
garbage collection on the other. They both have the
same set of changes from default and dev.power64.
LGTM=austin
R=austin
CC=golang-codereviews
https://codereview.appspot.com/172570043
Diffstat (limited to 'test')
-rw-r--r-- | test/clearfat.go | 68 | ||||
-rw-r--r-- | test/live.go | 2 | ||||
-rw-r--r-- | test/nilptr3.go | 2 |
3 files changed, 71 insertions, 1 deletions
diff --git a/test/clearfat.go b/test/clearfat.go new file mode 100644 index 000000000..45d539306 --- /dev/null +++ b/test/clearfat.go @@ -0,0 +1,68 @@ +// runoutput + +// Copyright 2014 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. + +// Check that {5,6,8,9}g/ggen.c:clearfat is zeroing the entire object. + +package main + +import ( + "bytes" + "fmt" + "strconv" + "strings" +) + +const ntest = 1100 + +func main() { + var decls, calls bytes.Buffer + + for i := 1; i <= ntest; i++ { + s := strconv.Itoa(i) + decls.WriteString(strings.Replace(decl, "$", s, -1)) + calls.WriteString(strings.Replace("poison$()\n\tclearfat$()\n\t", "$", s, -1)) + } + + program = strings.Replace(program, "$DECLS", decls.String(), 1) + program = strings.Replace(program, "$CALLS", calls.String(), 1) + fmt.Print(program) +} + +var program = `package main + +var count int + +$DECLS + +func main() { + $CALLS + if count != 0 { + println("failed", count, "case(s)") + } +} +` + +const decl = ` +func poison$() { + // Grow and poison the stack space that will be used by clearfat$ + var t [2*$]byte + for i := range t { + t[i] = 0xff + } +} + +func clearfat$() { + var t [$]byte + + for _, x := range t { + if x != 0 { +// println("clearfat$: index", i, "expected 0, got", x) + count++ + break + } + } +} +` diff --git a/test/live.go b/test/live.go index 55a1bd35d..62c6a0b0e 100644 --- a/test/live.go +++ b/test/live.go @@ -634,8 +634,8 @@ func newT40() *T40 { func bad40() { t := newT40() - printnl() _ = t + printnl() } func good40() { diff --git a/test/nilptr3.go b/test/nilptr3.go index 2757daef0..9d65e1e91 100644 --- a/test/nilptr3.go +++ b/test/nilptr3.go @@ -1,4 +1,6 @@ // errorcheck -0 -d=nil +// Fails on power64x because of incomplete optimization. See issue 9058. +// +build !power64,!power64le // Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style |