1 // Copyright 2017 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
13 for i, s := range globallib.Data {
15 panic("testLoop: mismatch")
21 func ptrData() *[1<<20 + 10]int64 {
22 return &globallib.Data
26 func testMediumOffset() {
27 for i, s := range globallib.Data[1<<16-2:] {
28 if s != int64(i)+1<<16-2 {
29 panic("testMediumOffset: index mismatch")
33 x := globallib.Data[1<<16-1]
35 panic("testMediumOffset: direct mismatch")
38 y := &globallib.Data[1<<16-3]
39 if y != &ptrData()[1<<16-3] {
40 panic("testMediumOffset: address mismatch")
45 func testLargeOffset() {
46 for i, s := range globallib.Data[1<<20:] {
47 if s != int64(i)+1<<20 {
48 panic("testLargeOffset: index mismatch")
52 x := globallib.Data[1<<20+1]
54 panic("testLargeOffset: direct mismatch")
57 y := &globallib.Data[1<<20+2]
58 if y != &ptrData()[1<<20+2] {
59 panic("testLargeOffset: address mismatch")
66 // SSA rules commonly merge offsets into addresses. These
67 // tests access global data in different ways to try
68 // and exercise different SSA rules.