}
 }
 
-func testCallersEqual(t *testing.T, pcs []uintptr, want []string) {
+func testCallersEqual(t *testing.T, pcs []uintptr, want []string, ignore map[string]struct{}) {
        got := make([]string, 0, len(want))
 
        frames := runtime.CallersFrames(pcs)
                if !more || len(got) >= len(want) {
                        break
                }
-               got = append(got, frame.Function)
+               if _, ok := ignore[frame.Function]; !ok {
+                       got = append(got, frame.Function)
+               }
        }
        if !reflect.DeepEqual(want, got) {
                t.Fatalf("wanted %v, got %v", want, got)
                pcs := make([]uintptr, 20)
                pcs = pcs[:runtime.Callers(0, pcs)]
                testCallers(t, pcs, true)
-               testCallersEqual(t, pcs, want)
+               testCallersEqual(t, pcs, want, nil)
        }()
        f1(true)
 }
                        if recover() == nil {
                                t.Fatal("did not panic")
                        }
-                       testCallersEqual(t, pcs, want)
+                       testCallersEqual(t, pcs, want, nil)
                }()
                if recover() == nil {
                        t.Fatal("did not panic")
        defer func() {
                pcs := make([]uintptr, 20)
                pcs = pcs[:runtime.Callers(0, pcs)]
-               testCallersEqual(t, pcs, want)
+               testCallersEqual(t, pcs, want, nil)
        }()
        defer func() {
                if recover() == nil {
                // recovered, there is no remaining panic on the stack.
                pcs := make([]uintptr, 20)
                pcs = pcs[:runtime.Callers(0, pcs)]
-               testCallersEqual(t, pcs, want)
+               testCallersEqual(t, pcs, want, nil)
        }()
        defer func() {
                r := recover()
        defer func() {
                pcs := make([]uintptr, 20)
                pcs = pcs[:runtime.Callers(0, pcs)]
-               testCallersEqual(t, pcs, want)
+               testCallersEqual(t, pcs, want, nil)
        }()
        func() {
                defer func() {
        want := []string{"runtime.Callers", "runtime_test.TestCallersNilPointerPanic.func1",
                "runtime.gopanic", "runtime.panicmem", "runtime.sigpanic",
                "runtime_test.TestCallersNilPointerPanic"}
+       ign := make(map[string]struct{})
        if runtime.Compiler == "gccgo" {
+               // The expected results of gollvm and gccgo are slightly different, the result
+               // of gccgo does not contain tRunner, and the result of gollvm does not contain
+               // sigpanic. Make these two elementes optional to pass both of gollvm and gccgo.
                want = []string{"runtime.Callers", "runtime_test.TestCallersNilPointerPanic..func1",
-                       "runtime.gopanic", "runtime.panicmem", "runtime.sigpanic",
+                       "runtime.gopanic", "runtime.panicmem",
                        "runtime_test.TestCallersNilPointerPanic"}
+               ign["runtime.sigpanic"] = struct{}{}
+               ign["testing.tRunner"] = struct{}{}
        }
 
        defer func() {
                }
                pcs := make([]uintptr, 20)
                pcs = pcs[:runtime.Callers(0, pcs)]
-               testCallersEqual(t, pcs, want)
+               testCallersEqual(t, pcs, want, ign)
        }()
        var p *int
        if *p == 3 {
                }
                pcs := make([]uintptr, 20)
                pcs = pcs[:runtime.Callers(0, pcs)]
-               testCallersEqual(t, pcs, want)
+               testCallersEqual(t, pcs, want, nil)
        }()
        var n int
        if 5/n == 1 {
                }
                pcs := make([]uintptr, 20)
                pcs = pcs[:runtime.Callers(0, pcs)]
-               testCallersEqual(t, pcs, want)
+               testCallersEqual(t, pcs, want, nil)
                if state == 1 {
                        t.Fatal("nil defer func panicked at defer time rather than function exit time")
                }
                }
                pcs := make([]uintptr, 20)
                pcs = pcs[:runtime.Callers(0, pcs)]
-               testCallersEqual(t, pcs, want)
+               testCallersEqual(t, pcs, want, nil)
                if state == 1 {
                        t.Fatal("nil defer func panicked at defer time rather than function exit time")
                }