Debian Codegraph @

test/fixedbugs/issue8155.go

raw
1 // run
2
3 // Copyright 2014 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
6
7 // Issue 8155.
8 // Alignment of stack prologue zeroing was wrong on 64-bit Native Client
9 // (because of 32-bit pointers).
10
11 package main
12
13 import "runtime"
14
15 func bad(b bool) uintptr {
16 var p **int
17 var x1 uintptr
18 x1 = 1
19 if b {
20 var x [11]*int
21 p = &x[0]
22 }
23 if b {
24 var x [1]*int
25 p = &x[0]
26 }
27 runtime.GC()
28 if p != nil {
29 x1 = uintptr(**p)
30 }
31 return x1
32 }
33
34 func poison() uintptr {
35 runtime.GC()
36 var x [20]uintptr
37 var s uintptr
38 for i := range x {
39 x[i] = uintptr(i+1)
40 s += x[i]
41 }
42 return s
43 }
44
45 func main() {
46 poison()
47 bad(false)
48 }