]> Cypherpunks.ru repositories - gostls13.git/blob - test/linkx.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / test / linkx.go
1 // skip
2
3 // Copyright 2012 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 // Test the -X facility of the gc linker (6l etc.).
8 // This test is run by linkx_run.go.
9
10 package main
11
12 import "fmt"
13
14 var tbd string
15 var overwrite string = "dibs"
16
17 var tbdcopy = tbd
18 var overwritecopy = overwrite
19 var arraycopy = [2]string{tbd, overwrite}
20
21 var b bool
22 var x int
23
24 func main() {
25         fmt.Println(tbd)
26         fmt.Println(tbdcopy)
27         fmt.Println(arraycopy[0])
28
29         fmt.Println(overwrite)
30         fmt.Println(overwritecopy)
31         fmt.Println(arraycopy[1])
32
33         // Check non-string symbols are not overwritten.
34         // This also make them used.
35         if b || x != 0 {
36                 panic("b or x overwritten")
37         }
38 }