diff --git a/src/runtime/crash_test.go b/src/runtime/crash_test.go index 46e7549d59..8efce4da2d 100644 --- a/src/runtime/crash_test.go +++ b/src/runtime/crash_test.go @@ -587,40 +587,3 @@ func main() { fmt.Println("done") } ` - -func TestInvalidptrCrash(t *testing.T) { - output := executeTest(t, invalidptrCrashSource, nil) - // Check that the bad pointer was detected. - want1 := "found bad pointer in Go heap" - if !strings.Contains(output, want1) { - t.Fatalf("failed to detect bad pointer; output does not contain %q:\n%s", want1, output) - } - // Check that we dumped the object containing the bad pointer. - want2 := "*(object+0) = 0x12345678" - if !strings.Contains(output, want2) { - t.Fatalf("failed to dump source object; output does not contain %q:\n%s", want2, output) - } -} - -const invalidptrCrashSource = ` -package main -import ( - "runtime" - "unsafe" -) -var x = new(struct { - magic uintptr - y *byte -}) -func main() { - runtime.GC() - x.magic = 0x12345678 - x.y = &make([]byte, 64*1024)[0] - weasel := uintptr(unsafe.Pointer(x.y)) - x.y = nil - runtime.GC() - x.y = (*byte)(unsafe.Pointer(weasel)) - runtime.GC() - println("failed to detect bad pointer") -} -`