~ubuntu-branches/ubuntu/saucy/golang/saucy

« back to all changes in this revision

Viewing changes to test/fixedbugs/bug273.go

  • Committer: Package Import Robot
  • Author(s): Adam Conrad
  • Date: 2013-07-08 05:52:37 UTC
  • mfrom: (29.1.1 sid)
  • Revision ID: package-import@ubuntu.com-20130708055237-at01839e0hp8z3ni
Tags: 2:1.1-1ubuntu1
016-armhf-elf-header.patch: Use correct ELF header for armhf binaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
 
9
9
package main
10
10
 
11
 
import "unsafe"
12
 
 
13
11
var bug = false
14
12
 
15
13
var minus1 = -1
 
14
var five = 5
16
15
var big int64 = 10 | 1<<32
17
16
 
18
 
var g1 []int
 
17
type block [1<<19]byte
 
18
 
 
19
var g1 []block
19
20
 
20
21
func shouldfail(f func(), desc string) {
21
22
        defer func() { recover() }()
28
29
}
29
30
 
30
31
func badlen() {
31
 
        g1 = make([]int, minus1)
 
32
        g1 = make([]block, minus1)
32
33
}
33
34
 
34
35
func biglen() {
35
 
        g1 = make([]int, big)
 
36
        g1 = make([]block, big)
36
37
}
37
38
 
38
39
func badcap() {
39
 
        g1 = make([]int, 10, minus1)
 
40
        g1 = make([]block, 10, minus1)
40
41
}
41
42
 
42
43
func badcap1() {
43
 
        g1 = make([]int, 10, 5)
 
44
        g1 = make([]block, 10, five)
44
45
}
45
46
 
46
47
func bigcap() {
47
 
        g1 = make([]int, 10, big)
 
48
        g1 = make([]block, 10, big)
48
49
}
49
50
 
50
 
var g3 map[int]int
 
51
var g3 map[block]block
51
52
func badmapcap() {
52
 
        g3 = make(map[int]int, minus1)
 
53
        g3 = make(map[block]block, minus1)
53
54
}
54
55
 
55
56
func bigmapcap() {
56
 
        g3 = make(map[int]int, big)
 
57
        g3 = make(map[block]block, big)
57
58
}
58
59
 
59
 
var g4 chan int
 
60
type cblock [1<<16-1]byte
 
61
 
 
62
var g4 chan cblock
60
63
func badchancap() {
61
 
        g4 = make(chan int, minus1)
 
64
        g4 = make(chan cblock, minus1)
62
65
}
63
66
 
64
67
func bigchancap() {
65
 
        g4 = make(chan int, big)
 
68
        g4 = make(chan cblock, big)
66
69
}
67
70
 
68
 
const addrBits = unsafe.Sizeof((*byte)(nil))
69
 
 
70
 
var g5 chan [1<<15]byte
71
71
func overflowchan() {
72
 
        if addrBits == 32 {
73
 
                g5 = make(chan [1<<15]byte, 1<<20)
74
 
        } else {
75
 
                // cannot overflow on 64-bit, because
76
 
                // int is 32 bits and max chan value size
77
 
                // in the implementation is 64 kB.
78
 
                panic(1)
79
 
        }
 
72
        g4 = make(chan cblock, 1<<30)
80
73
}
81
74
 
82
75
func main() {