[release-branch.go1.2] runtime: fix crash in runtime.GoroutineProfile

This CL is not exactly a copy of the original quoted below.
This CL omits the changes made to mgc0.c in the original.
Those changes do not apply cleanly to the Go 1.2 tree,
and they were cosmetic, simplifying code that was already
doing the right thing.

To double-check that omitting the mgc0.c change has not
invalidated the fix, I have verified by hand that the test program
in issue 6946 fails without this CL and passes with this CL.

««« CL 41640043 / e4c381446b48
runtime: fix crash in runtime.GoroutineProfile

This is a possible Go 1.2.1 candidate.

Fixes #6946.

R=iant, r
CC=golang-dev
https://golang.org/cl/41640043
»»»

LGTM=adg
R=adg
CC=golang-codereviews, golang-dev, iant, r
https://golang.org/cl/68820045
4 files changed