From 6e981c181ce1b8dd54ad83107cfddc954eea668f Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9my=20Oudompheng?= Date: Fri, 11 Jan 2013 00:59:44 +0100 Subject: [PATCH] runtime: work around 5c bug in GC code. 5c miscompiles *p++ = struct_literal. R=dave, golang-dev CC=golang-dev https://golang.org/cl/7065069 --- src/pkg/runtime/mgc0.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/pkg/runtime/mgc0.c b/src/pkg/runtime/mgc0.c index b612e6216a..e39e10f93c 100644 --- a/src/pkg/runtime/mgc0.c +++ b/src/pkg/runtime/mgc0.c @@ -338,7 +338,8 @@ flushptrbuf(PtrTarget *ptrbuf, PtrTarget **ptrbufpos, Obj **_wp, Workbuf **_wbuf if((bits & (bitAllocated|bitMarked)) != bitAllocated) continue; - *bitbufpos++ = (BitTarget){obj, ti, bitp, shift}; + *bitbufpos = (BitTarget){obj, ti, bitp, shift}; + bitbufpos++; } runtime·lock(&lock); @@ -541,7 +542,8 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking) // iface->tab if((void*)iface->tab >= arena_start && (void*)iface->tab < arena_used) { - *ptrbufpos++ = (PtrTarget){iface->tab, (uintptr)itabtype->gc}; + *ptrbufpos = (PtrTarget){iface->tab, (uintptr)itabtype->gc}; + ptrbufpos++; if(ptrbufpos == ptrbuf_end) flushptrbuf(ptrbuf, &ptrbufpos, &wp, &wbuf, &nobj, bitbuf); } @@ -568,7 +570,8 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking) stack_top.b += PtrSize; obj = *(byte**)i; if(obj >= arena_start && obj < arena_used) { - *ptrbufpos++ = (PtrTarget){obj, 0}; + *ptrbufpos = (PtrTarget){obj, 0}; + ptrbufpos++; if(ptrbufpos == ptrbuf_end) flushptrbuf(ptrbuf, &ptrbufpos, &wp, &wbuf, &nobj, bitbuf); } @@ -654,7 +657,8 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking) } if(obj >= arena_start && obj < arena_used) { - *ptrbufpos++ = (PtrTarget){obj, objti}; + *ptrbufpos = (PtrTarget){obj, objti}; + ptrbufpos++; if(ptrbufpos == ptrbuf_end) flushptrbuf(ptrbuf, &ptrbufpos, &wp, &wbuf, &nobj, bitbuf); } -- 2.48.1