1 // +build !js,!wasip1,gc
4 // Copyright 2014 The Go Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style
6 // license that can be found in the LICENSE file.
20 err := os.Chdir(filepath.Join("fixedbugs", "issue9355.dir"))
23 f, err := ioutil.TempFile("", "issue9355-*.o")
30 out := run("go", "tool", "compile", "-p=p", "-o", f.Name(), "-S", "a.go")
33 // 6g/8g print the offset as dec, but 5g/9g print the offset as hex.
35 `rel 0\+\d t=1 p\.x\+8\r?\n`, // y = &x.b
36 `rel 0\+\d t=1 p\.x\+(28|1c)\r?\n`, // z = &x.d.q
37 `rel 0\+\d t=1 p\.b\+5\r?\n`, // c = &b[5]
38 `rel 0\+\d t=1 p\.x\+(88|58)\r?\n`, // w = &x.f[3].r
40 for _, p := range patterns {
41 if ok, err := regexp.Match(p, out); !ok || err != nil {
43 panic("can't find pattern " + p)
48 func run(cmd string, args ...string) []byte {
49 out, err := exec.Command(cmd, args...).CombinedOutput()
51 fmt.Println(string(out))
58 func check(err error) {
60 fmt.Println("BUG:", err)