From: Dmitriy Vyukov Date: Wed, 10 Oct 2012 14:06:29 +0000 (+0400) Subject: runtime: fix race detector handling of stackalloc() X-Git-Tag: go1.1rc2~2165 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=27e93fbd00de218ba53a5b22333246abde88028c;p=gostls13.git runtime: fix race detector handling of stackalloc() R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6632051 --- diff --git a/src/pkg/runtime/race.c b/src/pkg/runtime/race.c index a94298f055..97bfe6864e 100644 --- a/src/pkg/runtime/race.c +++ b/src/pkg/runtime/race.c @@ -92,8 +92,11 @@ runtime·racefuncexit(void) void runtime·racemalloc(void *p, uintptr sz, void *pc) { + // use m->curg because runtime·stackalloc() is called from g0 + if(m->curg == nil) + return; m->racecall = true; - runtime∕race·Malloc(g->goid-1, p, sz, pc); + runtime∕race·Malloc(m->curg->goid-1, p, sz, pc); m->racecall = false; }