OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [fixedbugs/] [bug348.go] - Blame information for rev 700

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 700 jeremybenn
// $G $D/$F.go && $L $F.$A && ./$A.out
2
 
3
// Copyright 2011 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
package main
8
 
9
import (
10
        "runtime"
11
        "strings"
12
)
13
 
14
func f() {
15
        var x *string
16
 
17
        for _, i := range *x {  // THIS IS LINE 17
18
                println(i)
19
        }
20
}
21
 
22
func g() {
23
}
24
 
25
func main() {
26
        defer func() {
27
                for i := 0;; i++ {
28
                        pc, file, line, ok := runtime.Caller(i)
29
                        if !ok {
30
                                print("BUG: bug348: cannot find caller\n")
31
                                return
32
                        }
33
                        if !strings.Contains(file, "bug348.go") || runtime.FuncForPC(pc).Name() != "main.f" {
34
                                // walk past runtime frames
35
                                continue
36
                        }
37
                        if line != 17 {
38
                                print("BUG: bug348: panic at ", file, ":", line, " in ", runtime.FuncForPC(pc).Name(), "\n")
39
                                return
40
                        }
41
                        recover()
42
                        return
43
                }
44
        }()
45
        f()
46
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.