From a9b9ecc9ef3a73ac0ab74b57ca7ef864f1bd9ac8 Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Wed, 22 Oct 2014 16:39:31 -0400 Subject: [PATCH] [dev.power64] runtime: fix early GC of Defer objects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit go_bootstrap was panicking during runtime initialization (under runtime.main) because Defer objects were being prematurely GC'd. This happened because of an incorrect change to runtime·unrollgcprog_m to make it endian-agnostic during the conversion of runtime bitmaps to byte arrays. LGTM=rsc R=rsc CC=golang-codereviews https://golang.org/cl/161960044 --- src/runtime/mgc0.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/mgc0.c b/src/runtime/mgc0.c index d376c1cf695..02f7eba1202 100644 --- a/src/runtime/mgc0.c +++ b/src/runtime/mgc0.c @@ -1799,7 +1799,7 @@ runtime·unrollgcprog_m(void) } // atomic way to say mask[0] = 1 - x = typ->gc[0]; + x = *(uintptr*)mask; ((byte*)&x)[0] = 1; runtime·atomicstorep((void**)mask, (void*)x); }