diff options
Diffstat (limited to 'src/runtime/testdata')
| -rw-r--r-- | src/runtime/testdata/testprog/crash.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/runtime/testdata/testprog/crash.go b/src/runtime/testdata/testprog/crash.go index 4d83132198..c4990cdda9 100644 --- a/src/runtime/testdata/testprog/crash.go +++ b/src/runtime/testdata/testprog/crash.go @@ -11,6 +11,7 @@ import ( func init() { register("Crash", Crash) + register("DoublePanic", DoublePanic) } func test(name string) { @@ -43,3 +44,23 @@ func Crash() { testInNewThread("second-new-thread") test("main-again") } + +type P string + +func (p P) String() string { + // Try to free the "YYY" string header when the "XXX" + // panic is stringified. + runtime.GC() + runtime.GC() + runtime.GC() + return string(p) +} + +// Test that panic message is not clobbered. +// See issue 30150. +func DoublePanic() { + defer func() { + panic(P("YYY")) + }() + panic(P("XXX")) +} |
