runtime: ignore _Gscan bit when checking status in CgocallDone
commitca8c5fb39b7293f420eb842219c92cdac2d615d6
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Jun 2017 23:14:05 +0000 (12 23:14 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 12 Jun 2017 23:14:05 +0000 (12 23:14 +0000)
treed3dcd53208e91dad347a36dceeff7ac3d626c251
parent140fbe0fc07cb9835503d48d6e96aaa0f23f82bc
runtime: ignore _Gscan bit when checking status in CgocallDone

    Also always access the atomicstatus field atomically.

    The effect of not checking the _Gscan bit is that if the GC decides to
    scan the stack just as the goroutine is leaving the system call, the
    goroutine might fail to call exitsyscall.  Then then typically causes
    a runtime assertion failure later on.  If we do call exitsyscall as we
    should, it will stall (in casgstatus) until the _Gscan bit is cleared.

    No separate test.  I've observed causing sporadic failures running the
    misc/cgo tests, but we don't currently have a way to run those
    routinely for gccgo.  I should fix that.

    Reviewed-on: https://go-review.googlesource.com/45392

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@249138 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/go/gofrontend/MERGE
libgo/go/runtime/cgo_gccgo.go
libgo/go/runtime/proc.go