]> Cypherpunks repositories - gostls13.git/commitdiff
runtime: fix race detector handling of stackalloc()
authorDmitriy Vyukov <dvyukov@google.com>
Wed, 10 Oct 2012 14:06:29 +0000 (18:06 +0400)
committerDmitriy Vyukov <dvyukov@google.com>
Wed, 10 Oct 2012 14:06:29 +0000 (18:06 +0400)
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/6632051

src/pkg/runtime/race.c

index a94298f055d81ae56d29e82c79308e048041de84..97bfe6864ee94c3c49f1a55a297f3cd7879ab6ec 100644 (file)
@@ -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;
 }