Source file
test/abi/spills3.go
1
2
3
4
5
6
7
8
9
10
11
12 package main
13
14 import "fmt"
15
16 type i4 struct {
17 a, b, c, d int
18 }
19
20
21 func spills(px *i4) {
22 }
23
24
25
26 func F(x i4) i4 {
27 ab := x.a + x.b
28 bc := x.b + x.c
29 cd := x.c + x.d
30 ad := x.a + x.d
31 ba := x.a - x.b
32 cb := x.b - x.c
33 dc := x.c - x.d
34 da := x.a - x.d
35 i := i4{ab*bc + da, cd*ad + cb, ba*cb + ad, dc*da + bc}
36 spills(&i)
37 return i
38 }
39
40 func main() {
41 x := i4{1, 2, 3, 4}
42 y := x
43 z := F(x)
44 if z != (i4{12, 34, 6, 8}) {
45 fmt.Printf("y=%v, z=%v\n", y, z)
46 }
47 }
48
View as plain text